diff options
author | Monsta <[email protected]> | 2014-11-15 18:47:03 +0300 |
---|---|---|
committer | Stefano Karapetsas <[email protected]> | 2014-11-28 08:38:58 +0100 |
commit | 91871522b5d33dd4d762b28837039ecba2575d4b (patch) | |
tree | de4592b3e5a6c9f903a92c1ed88a140b2a1ee466 /libmate-desktop/mate-desktop-thumbnail.c | |
parent | f4b5f197de357a1e4a99fb79f8197c5c743f113c (diff) | |
download | mate-desktop-91871522b5d33dd4d762b28837039ecba2575d4b.tar.bz2 mate-desktop-91871522b5d33dd4d762b28837039ecba2575d4b.tar.xz |
avoid dereferencing NULL pointer
Closes https://github.com/mate-desktop/mate-desktop/pull/145
Diffstat (limited to 'libmate-desktop/mate-desktop-thumbnail.c')
-rw-r--r-- | libmate-desktop/mate-desktop-thumbnail.c | 6 |
1 files 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 (); |