diff options
author | Richard Hughes <richard@hughsie.com> | 2014-07-08 12:08:54 +0100 |
---|---|---|
committer | Richard Hughes <richard@hughsie.com> | 2014-07-08 12:09:28 +0100 |
commit | 895efb1371c25fbf007aadcd68421921c1e53991 (patch) | |
tree | f9db0845fdbeceb9bcb7fb60fa79e71a196ece62 /libappstream-glib/as-image.c | |
parent | 026afd62efe3e2bfeeb239ec32da61a8547763cf (diff) | |
download | appstream-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.c | 6 |
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, |