Prevent Gtk assertion failures when no icon is set.
authorLaurent Monin <geeqie@norz.org>
Sat, 28 Feb 2009 20:24:42 +0000 (20:24 +0000)
committerLaurent Monin <geeqie@norz.org>
Sat, 28 Feb 2009 20:24:42 +0000 (20:24 +0000)
src/layout_util.c
src/pixbuf_util.c

index 5a6e07e..7cd5916 100644 (file)
@@ -1652,7 +1652,7 @@ static void layout_actions_setup_editors(LayoutWindow *lw)
                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;
                        }
index 2f99d06..29640e1 100644 (file)
@@ -166,15 +166,18 @@ gboolean register_theme_icon_as_stock(const gchar *key, const gchar *icon)
        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;
                }