diff options
author | Philip Withnall <philip.withnall@collabora.co.uk> | 2013-10-10 14:22:35 +0100 |
---|---|---|
committer | Philip Withnall <philip.withnall@collabora.co.uk> | 2013-10-14 09:40:50 +0100 |
commit | b2d6cc3542b8b2fa787253bb45c22b5a151ac164 (patch) | |
tree | 8631a8f161f5998a756033e1bececabfe5722b96 /libgnome-desktop | |
parent | 40ecc92f964540d4475febd96a7663f68fbdc3b1 (diff) | |
download | gnome-desktop-b2d6cc3542b8b2fa787253bb45c22b5a151ac164.tar.gz |
thumbnailer: Bail if no pixbuf loader could be created
This prevents gdk_pixbuf_loader_close() from emitting a critical
error due to being called with a NULL loader. The loader can be NULL
if there was an error in the first read from the input stream.
https://bugzilla.gnome.org/show_bug.cgi?id=709819
Diffstat (limited to 'libgnome-desktop')
-rw-r--r-- | libgnome-desktop/gnome-desktop-thumbnail.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/libgnome-desktop/gnome-desktop-thumbnail.c b/libgnome-desktop/gnome-desktop-thumbnail.c index 6c31a976..68294ddc 100644 --- a/libgnome-desktop/gnome-desktop-thumbnail.c +++ b/libgnome-desktop/gnome-desktop-thumbnail.c @@ -440,14 +440,18 @@ _gdk_pixbuf_new_from_uri_at_scale (const char *uri, } } - if (gdk_pixbuf_loader_close (loader, &error) == FALSE) { + if (loader == NULL) { + /* This can happen if the above loop was exited due to the + * g_input_stream_read() call failing. */ + result = FALSE; + } else if (gdk_pixbuf_loader_close (loader, &error) == FALSE) { g_warning ("Error creating thumbnail for %s: %s", uri, error->message); g_clear_error (&error); result = FALSE; } if (!result) { - g_object_unref (G_OBJECT (loader)); + g_clear_object (&loader); g_input_stream_close (input_stream, NULL, NULL); g_object_unref (input_stream); g_object_unref (file); |