From 30a99fed423d95a830673fe70bf332b8fa241be3 Mon Sep 17 00:00:00 2001 From: diamondburned Date: Mon, 25 Mar 2024 12:21:38 -0700 Subject: [PATCH] Gotk4Gbox: Replace incorrect assertion with if check This silences the log message that's emitted when the assertion fails, even though the assertion is not fatal. See #138. --- pkg/core/gioutil/listmodel.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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)); }