From f9d0135a90a1995b850148327e72ec886f428689 Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Wed, 18 Nov 2020 11:31:57 +0000 Subject: [PATCH] gdatetime: Port to use new g_time_zone_new_identifier() constructor This allows slightly more reliable error checking on this code path. Signed-off-by: Philip Withnall Helps: #553 --- glib/gdatetime.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/glib/gdatetime.c b/glib/gdatetime.c index 1755257be..c2180e443 100644 --- a/glib/gdatetime.c +++ b/glib/gdatetime.c @@ -1383,15 +1383,15 @@ parse_iso8601_timezone (const gchar *text, gsize length, gssize *tz_offset) return NULL; *tz_offset = i; - tz = g_time_zone_new (text + i); + tz = g_time_zone_new_identifier (text + i); /* Double-check that the GTimeZone matches our interpretation of the timezone. * This can fail because our interpretation is less strict than (for example) * parse_time() in gtimezone.c, which restricts the range of the parsed * integers. */ - if (g_time_zone_get_offset (tz, 0) != offset_sign * (offset_hours * 3600 + offset_minutes * 60)) + if (tz == NULL || g_time_zone_get_offset (tz, 0) != offset_sign * (offset_hours * 3600 + offset_minutes * 60)) { - g_time_zone_unref (tz); + g_clear_pointer (&tz, g_time_zone_unref); return NULL; }