From a1c343953566254d590d0749bd3ddb53eeca6fec Mon Sep 17 00:00:00 2001 From: Georges Basile Stavracas Neto Date: Fri, 2 Oct 2026 18:19:13 -0300 Subject: [PATCH] views/agenda: Only scroll when there are items `gtk_list_view_scroll_to()` is documented to require that `pos` is smaller than the number of items in the model. We were not checking if the model was empty before calling this function, which could lead to criticals. Check if the listview model has any items before scrolling it. Part-of: --- src/gui/views/gcal-agenda-view.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gui/views/gcal-agenda-view.c b/src/gui/views/gcal-agenda-view.c index 8d0e7396..a7c0d582 100644 --- a/src/gui/views/gcal-agenda-view.c +++ b/src/gui/views/gcal-agenda-view.c @@ -255,7 +255,8 @@ gcal_agenda_view_set_date (GcalView *view, gcal_agenda_view_day_set_date (day, next_date); } - gtk_list_view_scroll_to (self->list_view, 0, GTK_LIST_SCROLL_FOCUS, NULL); + if (g_list_model_get_n_items (G_LIST_MODEL (self->flatten_model)) > 0) + gtk_list_view_scroll_to (self->list_view, 0, GTK_LIST_SCROLL_FOCUS, NULL); gcal_timeline_subscriber_range_changed (GCAL_TIMELINE_SUBSCRIBER (view));