[gnome-desktop/gnome-3-30] thumbnail: Fix runtime warning getting a preview icon



commit fbd7b59c1d4533a0fa8416da471c4e4e1f1b0343
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]