comparison src/pixbuf_util.c @ 1345:6fb0c1829b76

Prevent Gtk assertion failures when no icon is set.
author zas_
date Sat, 28 Feb 2009 20:24:42 +0000
parents 63eb48237608
children 9e7aed6ba6bd
comparison
equal deleted inserted replaced
1344:3f9be528787c 1345:6fb0c1829b76
164 GtkIconTheme *icon_theme; 164 GtkIconTheme *icon_theme;
165 GdkPixbuf *pixbuf; 165 GdkPixbuf *pixbuf;
166 GError *error = NULL; 166 GError *error = NULL;
167 167
168 icon_theme = gtk_icon_theme_get_default(); 168 icon_theme = gtk_icon_theme_get_default();
169 pixbuf = gtk_icon_theme_load_icon (icon_theme, 169 pixbuf = gtk_icon_theme_load_icon(icon_theme,
170 icon, /* icon name */ 170 icon, /* icon name */
171 64, /* size */ 171 64, /* size */
172 0, /* flags */ 172 0, /* flags */
173 &error); 173 &error);
174 if (!pixbuf) 174 if (!pixbuf)
175 { 175 {
176 DEBUG_1("Couldn't load icon: %s", error->message); 176 if (error)
177 g_error_free(error); 177 {
178 DEBUG_1("Couldn't load icon: %s", error->message);
179 g_error_free(error);
180 }
178 return FALSE; 181 return FALSE;
179 } 182 }
180 183
181 register_stock_icon(key, pixbuf); 184 register_stock_icon(key, pixbuf);
182 return TRUE; 185 return TRUE;