From 1f390c595014cf3fb77113544a21acf0fdcf5c30 Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Wed, 1 Apr 2020 18:07:44 +0100 Subject: pixdata: Bail out if the error is set We might still get a GdkPixbuf even if the GError is set, which leads to us reusing the GError instance later on. --- gdk-pixbuf/gdk-pixbuf-pixdata.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/gdk-pixbuf/gdk-pixbuf-pixdata.c b/gdk-pixbuf/gdk-pixbuf-pixdata.c index 3ce5a2b40..012bd2f3e 100644 --- a/gdk-pixbuf/gdk-pixbuf-pixdata.c +++ b/gdk-pixbuf/gdk-pixbuf-pixdata.c @@ -75,7 +75,7 @@ main (int argc, #endif pixbuf = gdk_pixbuf_new_from_file (infilename, &error); - if (!pixbuf) + if (error != NULL) { g_printerr ("failed to load \"%s\": %s\n", argv[1], @@ -88,6 +88,11 @@ G_GNUC_BEGIN_IGNORE_DEPRECATIONS free_me = gdk_pixdata_from_pixbuf (&pixdata, pixbuf, use_rle); data = gdk_pixdata_serialize (&pixdata, &data_len); G_GNUC_END_IGNORE_DEPRECATIONS + if (data == NULL) + { + g_printerr ("failed to serialize \"%s\"", argv[1]); + return 1; + } if (!g_file_set_contents (outfilename, (char *)data, data_len, &error)) { -- cgit v1.2.1