aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Uebernickel <lars.uebernickel@canonical.com>2014-03-28 11:27:12 +0100
committerLars Uebernickel <lars.uebernickel@canonical.com>2014-03-28 11:27:12 +0100
commit8269c14ba6a9865cfef818a5ceea0eb93f2ec2ae (patch)
tree05e40c30ce42a1c578518860a66deb2c8c2fc999
parentab158b1d5405ef962b63f21650521e762e35fc9b (diff)
downloadayatana-ido-8269c14ba6a9865cfef818a5ceea0eb93f2ec2ae.tar.gz
ayatana-ido-8269c14ba6a9865cfef818a5ceea0eb93f2ec2ae.tar.bz2
ayatana-ido-8269c14ba6a9865cfef818a5ceea0eb93f2ec2ae.zip
idobasicmenuitem: check return value of gtk_icon_info_get_filename() for NULL
-rw-r--r--src/idobasicmenuitem.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/idobasicmenuitem.c b/src/idobasicmenuitem.c
index da17211..6185d23 100644
--- a/src/idobasicmenuitem.c
+++ b/src/idobasicmenuitem.c
@@ -245,29 +245,35 @@ ido_basic_menu_item_set_icon (IdoBasicMenuItem * self, GIcon * icon)
if (p->icon != icon)
{
g_clear_object (&p->icon);
+ gtk_image_clear (GTK_IMAGE(p->image));
if (icon == NULL)
{
- gtk_image_clear (GTK_IMAGE(p->image));
gtk_widget_set_visible (p->image, FALSE);
}
else
{
GtkIconInfo *info;
const gchar *filename;
- GdkPixbuf *pixbuf;
p->icon = g_object_ref (icon);
info = gtk_icon_theme_lookup_by_gicon (gtk_icon_theme_get_default (), p->icon, 16, 0);
filename = gtk_icon_info_get_filename (info);
- pixbuf = gdk_pixbuf_new_from_file_at_scale (filename, -1, 16, TRUE, NULL);
- gtk_image_set_from_pixbuf (GTK_IMAGE(p->image), pixbuf);
- gtk_widget_set_visible (p->image, TRUE);
+ if (filename)
+ {
+ GdkPixbuf *pixbuf;
+
+ pixbuf = gdk_pixbuf_new_from_file_at_scale (filename, -1, 16, TRUE, NULL);
+ gtk_image_set_from_pixbuf (GTK_IMAGE(p->image), pixbuf);
+
+ g_object_unref (pixbuf);
+ }
+
+ gtk_widget_set_visible (p->image, filename != NULL);
g_object_unref (info);
- g_object_unref (pixbuf);
}
}
}