From a7fe0ab7cdf74ac73e4e3448e4fb29d4e7731f74 Mon Sep 17 00:00:00 2001
From: Milan Crha <mcrha@redhat.com>
Date: Thu, 4 Apr 2024 08:52:40 +0200
Subject: [PATCH] I#2712 - Crash when hiding completed tasks

Closes https://gitlab.gnome.org/GNOME/evolution/-/issues/2712
---
 src/calendar/gui/e-task-table.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/calendar/gui/e-task-table.c b/src/calendar/gui/e-task-table.c
index a8e906e3e4..d92b279cb2 100644
--- a/src/calendar/gui/e-task-table.c
+++ b/src/calendar/gui/e-task-table.c
@@ -1376,7 +1376,7 @@ hide_completed_rows_ready (GObject *source_object,
 {
 	ECalModel *model = user_data;
 	ECalClient *cal_client;
-	GSList *m, *objects;
+	GSList *m, *objects = NULL;
 	gboolean changed = FALSE;
 	gint pos;
 	GPtrArray *comp_objects;
@@ -1384,7 +1384,8 @@ hide_completed_rows_ready (GObject *source_object,
 
 	cal_client = E_CAL_CLIENT (source_object);
 
-	e_cal_client_get_object_list_finish (cal_client, result, &objects, &error);
+	if (!e_cal_client_get_object_list_finish (cal_client, result, &objects, &error))
+		objects = NULL;
 
 	if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
 		g_error_free (error);
@@ -1448,14 +1449,15 @@ show_completed_rows_ready (GObject *source_object,
 {
 	ECalClient *cal_client;
 	ECalModel *model = user_data;
-	GSList *m, *objects;
+	GSList *m, *objects = NULL;
 	GPtrArray *comp_objects;
 	GError *error = NULL;
 
 	cal_client = E_CAL_CLIENT (source_object);
 	g_return_if_fail (cal_client != NULL);
 
-	e_cal_client_get_object_list_finish (cal_client, result, &objects, &error);
+	if (!e_cal_client_get_object_list_finish (cal_client, result, &objects, &error))
+		objects = NULL;
 
 	if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
 		g_error_free (error);
-- 
GitLab

