columnview: Be more defensive
authorMatthias Clasen <mclasen@redhat.com>
Sun, 12 Mar 2023 07:23:16 +0000 (08:23 +0100)
committerMatthias Clasen <mclasen@redhat.com>
Sun, 12 Mar 2023 07:25:58 +0000 (08:25 +0100)
I am not sure how we can have no listitem here,
but better to be safe than sorry.

Fixes: #5659
gtk/gtkcolumnlistitemfactory.c

index 8ddffc252cfffa80ba0de29e257506a3656b911e..94a1695caaf747c7d63de09891900c6ad206c291 100644 (file)
@@ -112,13 +112,19 @@ gtk_column_list_item_factory_update (GtkListItemFactory *factory,
        child;
        child = gtk_widget_get_next_sibling (child))
     {
+      GtkListItem *cell_item;
+
       gtk_list_item_widget_update (GTK_LIST_ITEM_WIDGET (child),
                                    gtk_list_item_get_position (list_item),
                                    gtk_list_item_get_item (list_item),
                                    gtk_list_item_get_selected (list_item));
 
-       selectable &= gtk_list_item_get_selectable (gtk_list_item_widget_get_list_item (GTK_LIST_ITEM_WIDGET (child)));
-       activatable &= gtk_list_item_get_activatable (gtk_list_item_widget_get_list_item (GTK_LIST_ITEM_WIDGET (child)));
+       cell_item = gtk_list_item_widget_get_list_item (GTK_LIST_ITEM_WIDGET (child));
+       if (cell_item)
+         {
+           selectable &= gtk_list_item_get_selectable (cell_item);
+           activatable &= gtk_list_item_get_activatable (cell_item);
+        }
     }
 
   /* This really does not belong here, but doing better