[gtk] Survive absence of librsvg without criticals



commit 0c87b6225142cb97e1ffa763bca26ee0e1b8f717
Author: Matthias Clasen <mclasen redhat com>
Date:   Thu Apr 18 00:12:34 2019 +0000

    Survive absence of librsvg without criticals
    
    We can't guarantee that we can load svgs, so
    we shouldn't spew criticals when some of our
    own resources fail to load due to that reason.

 gtk/tools/gdkpixbufutils.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
---
diff --git a/gtk/tools/gdkpixbufutils.c b/gtk/tools/gdkpixbufutils.c
index 0ed23bd3dc..0f4b7f09b5 100644
--- a/gtk/tools/gdkpixbufutils.c
+++ b/gtk/tools/gdkpixbufutils.c
@@ -364,11 +364,14 @@ gtk_make_symbolic_texture_from_resource (const char  *path,
                                          GError     **error)
 {
   GdkPixbuf *pixbuf;
-  GdkTexture *texture;
+  GdkTexture *texture = NULL;
 
   pixbuf = gtk_make_symbolic_pixbuf_from_resource (path, width, height, scale, error);
-  texture = gdk_texture_new_for_pixbuf (pixbuf);
-  g_object_unref (pixbuf);
+  if (pixbuf)
+    {
+      texture = gdk_texture_new_for_pixbuf (pixbuf);
+      g_object_unref (pixbuf);
+    }
 
   return texture;
 }


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