changeset 1345:6fb0c1829b76

Prevent Gtk assertion failures when no icon is set.
author zas_
date Sat, 28 Feb 2009 20:24:42 +0000
parents 3f9be528787c
children c9949c19a6d0
files src/layout_util.c src/pixbuf_util.c
diffstat 2 files changed, 7 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/layout_util.c	Sat Feb 28 20:13:11 2009 +0000
+++ b/src/layout_util.c	Sat Feb 28 20:24:42 2009 +0000
@@ -1652,7 +1652,7 @@
 		EditorDescription *editor = work->data;
 		GtkActionEntry entry = { editor->key, NULL, editor->name, editor->hotkey, NULL, G_CALLBACK(layout_menu_edit_cb) };
 		
-		if (register_theme_icon_as_stock(editor->key, editor->icon))
+		if (editor->icon && register_theme_icon_as_stock(editor->key, editor->icon))
 			{
 			entry.stock_id = editor->key;
 			}
--- a/src/pixbuf_util.c	Sat Feb 28 20:13:11 2009 +0000
+++ b/src/pixbuf_util.c	Sat Feb 28 20:24:42 2009 +0000
@@ -166,15 +166,18 @@
 	GError *error = NULL;
 
 	icon_theme = gtk_icon_theme_get_default();
-	pixbuf = gtk_icon_theme_load_icon (icon_theme,
+	pixbuf = gtk_icon_theme_load_icon(icon_theme,
                            icon, /* icon name */
                            64, /* size */
                            0,  /* flags */
                            &error);
 	if (!pixbuf) 
 		{
-		DEBUG_1("Couldn't load icon: %s", error->message);
-		g_error_free(error);
+		if (error)
+			{
+			DEBUG_1("Couldn't load icon: %s", error->message);
+			g_error_free(error);
+			}
 		return FALSE;
 		}