[gnome-menus] libmenu: Don't try to unref potentially NULL pointers



commit 739d3f6ef7d533544f1ec2b4d6e237bfaca99e85
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Sun Aug 21 17:27:50 2011 -0400

    libmenu: Don't try to unref potentially NULL pointers
    
    When a DIRECTORY desktop entry fails to load, we'll try to unref
    some NULL pointers. This was causing some warnings.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=657042

 libmenu/desktop-entries.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/libmenu/desktop-entries.c b/libmenu/desktop-entries.c
index fc7590b..bb6076d 100644
--- a/libmenu/desktop-entries.c
+++ b/libmenu/desktop-entries.c
@@ -497,8 +497,11 @@ desktop_entry_unref (DesktopEntry *entry)
       g_free (entry_directory->comment);
       entry_directory->comment = NULL;
 
-      g_object_unref (entry_directory->icon);
-      entry_directory->icon = NULL;
+      if (entry_directory->icon != NULL)
+        {
+          g_object_unref (entry_directory->icon);
+          entry_directory->icon = NULL;
+        }
     }
   else
     g_assert_not_reached ();



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