IconHelper: Avoid warnings for non-existing stock ids

There are some registred stock ids like gtk-discards that have no icons,
and you could also pass a non-registred stock id. Both of these means
gtk_style_context_lookup_icon_set returns NULL, which causes
a critical in gtk_icon_set_render_icon_pixbuf.

We avoid this by just making these render as EMPTY.
This commit is contained in:
Alexander Larsson 2012-12-13 10:08:37 +01:00
parent 656ec39c29
commit 444a92d6d8

View File

@ -325,7 +325,10 @@ _gtk_icon_helper_ensure_pixbuf (GtkIconHelper *self,
case GTK_IMAGE_STOCK:
icon_set = gtk_style_context_lookup_icon_set (context, self->priv->stock_id);
ensure_pixbuf_for_icon_set (self, context, icon_set);
if (icon_set != NULL)
ensure_pixbuf_for_icon_set (self, context, icon_set);
else
pixbuf = NULL;
break;
case GTK_IMAGE_ICON_SET: