From 0a72c0531105520b404f2e34984e94ebaebd39ac Mon Sep 17 00:00:00 2001 From: mindonwarp Date: Sat, 3 Oct 2026 11:42:13 +0200 Subject: [PATCH] views/agenda: Fix critical in first weekday changed The `gcal_agenda_view_first_weekday_changed` uses the same `gtk_list_view_scroll_to` method that expects the scroll position to be smaller than the number of items in the list model. When the list model contains no items, the method reports a critical which crashes the Calendar whith `fatal-criticals` enabled. This is the same fix that Georges made in the `gcal_agenda_view_set_date` method. We now check the number of items before trying to scroll the list view to position zero. Part-of: --- src/gui/views/gcal-agenda-view.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/gui/views/gcal-agenda-view.c b/src/gui/views/gcal-agenda-view.c index a7c0d582..3ebfa9d8 100644 --- a/src/gui/views/gcal-agenda-view.c +++ b/src/gui/views/gcal-agenda-view.c @@ -305,7 +305,9 @@ gcal_agenda_view_first_weekday_changed (GcalView *view) { GcalAgendaView *self = GCAL_AGENDA_VIEW (view); - 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)); }