diff gtk3/dw.c @ 1709:de49c1f284b2

Safety check for the icon resize code on Mac and GTK.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Sat, 05 May 2012 21:41:57 +0000
parents fb6807b0ab0d
children fae374a0055b
line wrap: on
line diff
--- a/gtk3/dw.c	Sat May 05 21:32:50 2012 +0000
+++ b/gtk3/dw.c	Sat May 05 21:41:57 2012 +0000
@@ -5669,14 +5669,17 @@
 /* Internal function to keep HICNs from getting too big */
 GdkPixbuf *_icon_resize(GdkPixbuf *ret)
 {
-   int pwidth = gdk_pixbuf_get_width(ret);
-   int pheight = gdk_pixbuf_get_height(ret);
-   
-   if(pwidth > 24 || pheight > 24)
-   {
-      GdkPixbuf *orig = ret;
-      ret = gdk_pixbuf_scale_simple(ret, pwidth > 24 ? 24 : pwidth, pheight > 24 ? 24 : pheight, GDK_INTERP_BILINEAR);
-      g_object_unref(G_OBJECT(orig));
+   if(ret)
+   {
+      int pwidth = gdk_pixbuf_get_width(ret);
+      int pheight = gdk_pixbuf_get_height(ret);
+      
+      if(pwidth > 24 || pheight > 24)
+      {
+         GdkPixbuf *orig = ret;
+         ret = gdk_pixbuf_scale_simple(ret, pwidth > 24 ? 24 : pwidth, pheight > 24 ? 24 : pheight, GDK_INTERP_BILINEAR);
+         g_object_unref(G_OBJECT(orig));
+      }
    }
    return ret;
 }