ui/gtk/list.c

changeset 50
9c25e2616bfa
parent 46
31bc86844659
child 51
e324291ca9f8
--- a/ui/gtk/list.c	Sun Oct 06 18:18:04 2024 +0200
+++ b/ui/gtk/list.c	Sun Oct 06 18:43:06 2024 +0200
@@ -114,20 +114,24 @@
                     case UI_ICON_TEXT_FREE: {
                         UiIcon *icon = data;
 #if GTK_MAJOR_VERSION >= 4
-                        GValue iconvalue = G_VALUE_INIT;
-                        g_value_init(&iconvalue, G_TYPE_OBJECT);
-                        g_value_set_object(&iconvalue, ui_icon_pixbuf(icon));
-                        gtk_list_store_set_value(store, &iter, c, &iconvalue);
+                        if(icon) {
+                            GValue iconvalue = G_VALUE_INIT;
+                            g_value_init(&iconvalue, G_TYPE_OBJECT);
+                            g_value_set_object(&iconvalue, ui_icon_pixbuf(icon));
+                            gtk_list_store_set_value(store, &iter, c, &iconvalue);
+                        }
 #else
                         GValue pixbufvalue = G_VALUE_INIT;
-                        if(!icon->pixbuf && icon->info) {
-                            GError *error = NULL;
-                            GdkPixbuf *pixbuf = gtk_icon_info_load_icon(icon->info, &error);
-                            icon->pixbuf = pixbuf;
+                        if(icon) {
+                            if(!icon->pixbuf && icon->info) {
+                                GError *error = NULL;
+                                GdkPixbuf *pixbuf = gtk_icon_info_load_icon(icon->info, &error);
+                                icon->pixbuf = pixbuf;
+                            }
+                            g_value_init(&pixbufvalue, G_TYPE_OBJECT);
+                            g_value_set_object(&pixbufvalue, icon->pixbuf);
+                            gtk_list_store_set_value(store, &iter, c, &pixbufvalue);
                         }
-                        g_value_init(&pixbufvalue, G_TYPE_OBJECT);
-                        g_value_set_object(&pixbufvalue, icon->pixbuf);
-                        gtk_list_store_set_value(store, &iter, c, &pixbufvalue);
 #endif
                         c++;
                         

mercurial