[gnome-packagekit/gnome-2-30] Ignore message types we do not recognize. Fixes rh#575669



commit 957931a37e4867c90c45029c2a040550f08b59e7
Author: Richard Hughes <richard hughsie com>
Date:   Fri Jul 2 08:55:26 2010 +0100

    Ignore message types we do not recognize. Fixes rh#575669
    
    If the daemon was built later than the client tools, the daemon
    could send message types that the client does not recognize, and
    does not have translations for. In this case ignore the message, as
    we don't have anything useful (other than the enum number) to show
    in the UI.
    
    This should stop the message icon appearing and the when the user
    clicks on it, they find the message is missing.
    
    Thanks to Jcarr for debugging.

 src/gpk-watch.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
---
diff --git a/src/gpk-watch.c b/src/gpk-watch.c
index 7ab51c7..9ff02a7 100644
--- a/src/gpk-watch.c
+++ b/src/gpk-watch.c
@@ -1299,6 +1299,12 @@ gpk_watch_process_messages_cb (PkMessage *item, GpkWatch *watch)
 		      "details", &details,
 		      NULL);
 
+	/* this is message unrecognised */
+	if (gpk_message_enum_to_localised_text (type) == NULL) {
+		egg_warning ("message unrecognized, and thus ignored: %i", type);
+		goto out;
+	}
+
 	/* is ignored */
 	ret = gpk_watch_is_message_ignored (watch, type);
 	if (ret) {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]