From 56cd9069eed492655c3d79f21a89b987432d3a3c Mon Sep 17 00:00:00 2001 From: Bastien Nocera Date: Tue, 15 Mar 2011 01:57:15 +0000 Subject: [PATCH] datetime: Don't crash when the timezone is unknown Passing "posixrules" to cc_timezone_map_set_timezone() certainly won't work that well. https://bugzilla.redhat.com/show_bug.cgi?id=684593 --- panels/datetime/cc-datetime-panel.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/panels/datetime/cc-datetime-panel.c b/panels/datetime/cc-datetime-panel.c index e753cbd12..5eba0861f 100644 --- a/panels/datetime/cc-datetime-panel.c +++ b/panels/datetime/cc-datetime-panel.c @@ -33,6 +33,8 @@ #include #include +/* FIXME: This should be "Etc/GMT" instead */ +#define DEFAULT_TZ "Europe/London" #define GETTEXT_PACKAGE_TIMEZONES GETTEXT_PACKAGE "-timezones" G_DEFINE_DYNAMIC_TYPE (CcDateTimePanel, cc_date_time_panel, CC_TYPE_PANEL) @@ -482,7 +484,11 @@ get_timezone_cb (CcDateTimePanel *self, } else { - cc_timezone_map_set_timezone (CC_TIMEZONE_MAP (self->priv->map), timezone); + if (!cc_timezone_map_set_timezone (CC_TIMEZONE_MAP (self->priv->map), timezone)) + { + g_warning ("Timezone '%s' is unhandled, setting %s as default", timezone, DEFAULT_TZ); + cc_timezone_map_set_timezone (CC_TIMEZONE_MAP (self->priv->map), DEFAULT_TZ); + } self->priv->current_location = cc_timezone_map_get_location (CC_TIMEZONE_MAP (self->priv->map)); update_timezone (self); }