[gnome-settings-daemon] print-notifications: Fix possible NULL dereferences



commit a33a74840f55e2d5e844f7491c27e23ff42c36c0
Author: Bastien Nocera <hadess hadess net>
Date:   Thu Oct 20 16:53:04 2011 +0100

    print-notifications: Fix possible NULL dereferences

 .../gsd-print-notifications-manager.c              |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/plugins/print-notifications/gsd-print-notifications-manager.c b/plugins/print-notifications/gsd-print-notifications-manager.c
index e02610c..0c36edb 100644
--- a/plugins/print-notifications/gsd-print-notifications-manager.c
+++ b/plugins/print-notifications/gsd-print-notifications-manager.c
@@ -478,7 +478,7 @@ on_cups_notification (GDBusConnection *connection,
                                strcmp0);
 
                         j = 0;
-                        for (i = 0; i < g_strv_length (new_state_reasons); i++) {
+                        for (i = 0; new_state_reasons && i < g_strv_length (new_state_reasons); i++) {
                                 while (old_state_reasons[j] &&
                                        g_strcmp0 (old_state_reasons[j], new_state_reasons[i]) < 0)
                                         j++;
@@ -490,7 +490,7 @@ on_cups_notification (GDBusConnection *connection,
                         }
                 }
                 else {
-                        for (i = 0; i < g_strv_length (new_state_reasons); i++) {
+                        for (i = 0; new_state_reasons && i < g_strv_length (new_state_reasons); i++) {
                                 added_reasons = g_slist_append (added_reasons,
                                                                 new_state_reasons[i]);
                         }



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