From 91871522b5d33dd4d762b28837039ecba2575d4b Mon Sep 17 00:00:00 2001 From: Monsta Date: Sat, 15 Nov 2014 18:47:03 +0300 Subject: avoid dereferencing NULL pointer Closes https://github.com/mate-desktop/mate-desktop/pull/145 --- libmate-desktop/mate-desktop-thumbnail.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/libmate-desktop/mate-desktop-thumbnail.c b/libmate-desktop/mate-desktop-thumbnail.c index d974b37..4d287fb 100644 --- a/libmate-desktop/mate-desktop-thumbnail.c +++ b/libmate-desktop/mate-desktop-thumbnail.c @@ -303,13 +303,11 @@ create_loader (GFile *file, const guchar *data, gsize size) { - GdkPixbufLoader *loader; + GdkPixbufLoader *loader = NULL; GError *error = NULL; char *mime_type; char *filename; - loader = NULL; - /* need to specify the type here because the gdk_pixbuf_loader_write doesn't have access to the filename in order to correct detect the image type. */ @@ -321,7 +319,7 @@ create_loader (GFile *file, loader = gdk_pixbuf_loader_new_with_mime_type (mime_type, &error); } - if (loader == NULL) { + if (loader == NULL && error != NULL) { g_warning ("Unable to create loader for mime type %s: %s", mime_type, error->message); g_clear_error (&error); loader = gdk_pixbuf_loader_new (); -- cgit v1.2.1