procmime_get_part_as_pixbuf: set error if we can't decode part.
authorColin Leroy <colin@colino.net>
Sun, 7 Jul 2019 10:21:50 +0000 (12:21 +0200)
committerColin Leroy <colin@colino.net>
Sun, 7 Jul 2019 10:21:50 +0000 (12:21 +0200)
src/procmime.c

index 1f126ecd2ac6ae3ba592bb792cd97963456b0866..cfcc6428e0fb4d53f679d33be7590ab09ba03193 100644 (file)
@@ -2746,19 +2746,22 @@ GdkPixbuf *procmime_get_part_as_pixbuf(MimeInfo *mimeinfo, GError **error)
        GdkPixbuf *pixbuf;
        GInputStream *stream;
 
        GdkPixbuf *pixbuf;
        GInputStream *stream;
 
-       *error = NULL;
+       if (error)
+               *error = NULL;
 
        stream = procmime_get_part_as_inputstream(mimeinfo);
        if (stream == NULL) {
 
        stream = procmime_get_part_as_inputstream(mimeinfo);
        if (stream == NULL) {
+               if (*error)
+                       *error = g_error_new_literal(G_FILE_ERROR, -1, _("Could not decode part"));
                return NULL;
        }
 
        pixbuf = gdk_pixbuf_new_from_stream(stream, NULL, error);
        g_object_unref(stream);
 
                return NULL;
        }
 
        pixbuf = gdk_pixbuf_new_from_stream(stream, NULL, error);
        g_object_unref(stream);
 
-       if (*error != NULL) {
+       if (*error != NULL)
                return NULL;
                return NULL;
-       }
+
        return pixbuf;
 }
 
        return pixbuf;
 }