summaryrefslogtreecommitdiff
path: root/libappstream-glib/as-image.c
diff options
context:
space:
mode:
authorRichard Hughes <richard@hughsie.com>2014-07-08 12:08:54 +0100
committerRichard Hughes <richard@hughsie.com>2014-07-08 12:09:28 +0100
commit895efb1371c25fbf007aadcd68421921c1e53991 (patch)
treef9db0845fdbeceb9bcb7fb60fa79e71a196ece62 /libappstream-glib/as-image.c
parent026afd62efe3e2bfeeb239ec32da61a8547763cf (diff)
downloadappstream-glib-895efb1371c25fbf007aadcd68421921c1e53991.tar.gz
Allow calling as_image_set_pixbuf() with a NULL pixbuf
Diffstat (limited to 'libappstream-glib/as-image.c')
-rw-r--r--libappstream-glib/as-image.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/libappstream-glib/as-image.c b/libappstream-glib/as-image.c
index 51d4a14..98ee429 100644
--- a/libappstream-glib/as-image.c
+++ b/libappstream-glib/as-image.c
@@ -337,7 +337,7 @@ as_image_set_kind (AsImage *image, AsImageKind kind)
/**
* as_image_set_pixbuf:
* @image: a #AsImage instance.
- * @pixbuf: the #GdkPixbuf
+ * @pixbuf: the #GdkPixbuf, or %NULL
*
* Sets the image pixbuf.
*
@@ -352,6 +352,10 @@ as_image_set_pixbuf (AsImage *image, GdkPixbuf *pixbuf)
if (priv->pixbuf != NULL)
g_object_unref (priv->pixbuf);
+ if (pixbuf == NULL) {
+ priv->pixbuf = NULL;
+ return;
+ }
if (priv->md5 == NULL) {
data = gdk_pixbuf_get_pixels_with_length (pixbuf, &len);
priv->md5 = g_compute_checksum_for_data (G_CHECKSUM_MD5,