diff --git a/pkg/core/gioutil/listmodel.c b/pkg/core/gioutil/listmodel.c index a34f46dc8..a28be4db9 100644 --- a/pkg/core/gioutil/listmodel.c +++ b/pkg/core/gioutil/listmodel.c @@ -59,7 +59,9 @@ static guint gotk4_gbox_list_get_n_items(GListModel *list) { static gpointer gotk4_gbox_list_get_item(GListModel *list, guint index) { Gotk4GboxList *self = GOTK4_GBOX_LIST(list); - g_return_val_if_fail(index < objects_get_size(&self->items), NULL); + if (index >= objects_get_size(&self->items)) { + return NULL; + } return g_object_ref(objects_get(&self->items, index)); }