manager: Always return if calendar creation fails

This is an embarrassing mistake: when an error is propagated,
we always need to return! The error matching should only be
used for deciding whether to warn or not.

https://gitlab.gnome.org/GNOME/gnome-calendar/issues/470
https://gitlab.gnome.org/GNOME/gnome-calendar/issues/264
This commit is contained in:
Georges Basile Stavracas Neto
2019-10-09 12:37:01 -03:00
parent e053c0cae8
commit 1308e33f1d
+6 -4
View File
@@ -258,11 +258,13 @@ on_calendar_created_cb (GObject *source_object,
self = GCAL_MANAGER (user_data);
calendar = gcal_calendar_new_finish (result, &error);
if (error &&
!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED) &&
!g_error_matches (error, GCAL_CALENDAR_ERROR, GCAL_CALENDAR_ERROR_NOT_CALENDAR))
if (error)
{
g_warning ("Failed to open/connect to calendar: %s", error->message);
if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED) &&
!g_error_matches (error, GCAL_CALENDAR_ERROR, GCAL_CALENDAR_ERROR_NOT_CALENDAR))
{
g_warning ("Failed to open/connect to calendar: %s", error->message);
}
return;
}