Mercurial > dwindows
diff gtk/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 | 0b1be0a99f59 |
children | df5f0857f765 |
line wrap: on
line diff
--- a/gtk/dw.c Sat May 05 21:32:50 2012 +0000 +++ b/gtk/dw.c Sat May 05 21:41:57 2012 +0000 @@ -6963,14 +6963,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; }