[gnome-desktop/wip/hadess/fix-runtime-warning] thumbnail: Fix runtime warning getting a preview icon



commit bbae26a69c6f3a407a1770611ed42087f16ad223
Author: Bastien Nocera <hadess hadess net>
Date:   Mon Jan 28 17:35:28 2019 +0100

    thumbnail: Fix runtime warning getting a preview icon
    
    If we tried to get a preview thumbnail for a file, but that preview icon
    did not exist, then we'd generate a warning trying to add a reference to
    that GIcon.
    
    Fixes: e629e46a5409589c0701dd00bc04e948ee22560a

 libgnome-desktop/gnome-desktop-thumbnail.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/libgnome-desktop/gnome-desktop-thumbnail.c b/libgnome-desktop/gnome-desktop-thumbnail.c
index f48fd461..566fbeb8 100644
--- a/libgnome-desktop/gnome-desktop-thumbnail.c
+++ b/libgnome-desktop/gnome-desktop-thumbnail.c
@@ -967,8 +967,10 @@ get_preview_thumbnail (const char *uri,
     if (file_info == NULL)
       return NULL;
 
-    object = g_object_ref (g_file_info_get_attribute_object (file_info,
-                                                             G_FILE_ATTRIBUTE_PREVIEW_ICON));
+    object = g_file_info_get_attribute_object (file_info,
+                                               G_FILE_ATTRIBUTE_PREVIEW_ICON);
+    if (object)
+        g_object_ref (object);
     g_object_unref (file_info);
 
     if (!object)


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