time-zone-monitor: Use local timezone as fallback without dbus service

On systems without anything providing the org.freedesktop.timedate1
interface, the timezone returned by the monitor would always be NULL,
because it was never set. This can lead to crashes in places that expect
the monitor to always return a valid timezone. So in that case use the
local timezone from when the monitor got initialized.

Fixes https://gitlab.gnome.org/GNOME/gnome-calendar/-/issues/703
This commit is contained in:
Sebastian Keller
2021-04-11 00:27:08 +00:00
committed by Georges Basile Stavracas Neto
parent a0d24cd5d8
commit fb242dd109
+2
View File
@@ -139,6 +139,8 @@ gcal_time_zone_monitor_init (GcalTimeZoneMonitor *self)
GCAL_ENTRY;
self->timezone = g_time_zone_new_local ();
connection = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, NULL);
if (!connection)