From a2ac8937bf2808df15d349f369037ad5f2e863d6 Mon Sep 17 00:00:00 2001 From: Paolo Borelli Date: Thu, 15 Jan 2004 08:16:40 +0000 Subject: [PATCH] Don't crash if the widget doesn't have a valid icon. --- ChangeLog | 5 +++++ src/glade-project-view.c | 16 ++++++++++------ 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index bec69382..c495a5a1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -61,6 +61,11 @@ * src/glade-utils.c: missing include. * src/glade-placeholder: missing include. +2004-01-15 Paolo Borelli + + * src/glade-project-view.c: don't crash im the widget doesn't have + a valid icon. + 2003-11-13 Paolo Borelli * src/glade-command.c: free the value of the set property command in the diff --git a/src/glade-project-view.c b/src/glade-project-view.c index 8e01d1fe..b5567bc5 100644 --- a/src/glade-project-view.c +++ b/src/glade-project-view.c @@ -427,13 +427,17 @@ glade_project_view_cell_function (GtkTreeViewColumn *tree_column, g_return_if_fail (widget->class->icon != NULL); if (is_icon) - g_object_set (G_OBJECT (cell), - "pixbuf", gtk_image_get_pixbuf (GTK_IMAGE (widget->class->icon)), - NULL); + { + if (gtk_image_get_storage_type GTK_IMAGE (widget->class->icon) != GTK_IMAGE_PIXBUF) + return; + + g_object_set (G_OBJECT (cell), "pixbuf", + gtk_image_get_pixbuf (GTK_IMAGE (widget->class->icon)), NULL); + } else - g_object_set (G_OBJECT (cell), - "text", widget->name, - NULL); + { + g_object_set (G_OBJECT (cell), "text", widget->name, NULL); + } } static void