[goffice] GOImage: improve error handling.



commit 909948e340f5e63bb81a2cb40e8022a74695aea0
Author: Morten Welinder <terra gnome org>
Date:   Sat Feb 28 14:23:46 2015 -0500

    GOImage: improve error handling.

 goffice/utils/go-pixbuf.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
---
diff --git a/goffice/utils/go-pixbuf.c b/goffice/utils/go-pixbuf.c
index 001b854..9c36bf5 100644
--- a/goffice/utils/go-pixbuf.c
+++ b/goffice/utils/go-pixbuf.c
@@ -386,6 +386,11 @@ GOImage *
 go_pixbuf_new_from_data (char const *type, guint8 const *data, gsize length, GError **error)
 {
        GOImage *image = g_object_new (GO_TYPE_PIXBUF, NULL);
+       GError *dummy = NULL;
+
+       if (!error)
+               error = &dummy;
+
        image->data = g_memdup (data, length);
        image->data_length = length;
        g_object_set (image, "image-type", type, NULL);
@@ -394,6 +399,10 @@ go_pixbuf_new_from_data (char const *type, guint8 const *data, gsize length, GEr
                g_object_unref (image);
                return NULL;
        }
+
+       if (dummy)
+               g_error_free (dummy);
+
        return image;
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]