[libgweather] GWeatherTimezone: Add guard to gweather_timezone_get_by_tzid()
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgweather] GWeatherTimezone: Add guard to gweather_timezone_get_by_tzid()
- Date: Wed, 6 Dec 2017 14:23:29 +0000 (UTC)
commit 10f1bf6339ea9f6aabc2bb3beeef23f037594384
Author: Bastien Nocera <hadess hadess net>
Date: Wed Dec 6 14:43:43 2017 +0100
GWeatherTimezone: Add guard to gweather_timezone_get_by_tzid()
This led to a crash in my badly written test code, a g_warning() is
more useful to show incorrect API usage.
https://bugzilla.gnome.org/show_bug.cgi?id=791307
libgweather/gweather-timezone.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
---
diff --git a/libgweather/gweather-timezone.c b/libgweather/gweather-timezone.c
index a120061..a513fd9 100644
--- a/libgweather/gweather-timezone.c
+++ b/libgweather/gweather-timezone.c
@@ -165,6 +165,8 @@ gweather_timezone_get_by_tzid (const char *tzid)
{
GWeatherLocation *world;
+ g_return_val_if_fail (tzid != NULL, NULL);
+
world = gweather_location_get_world ();
return g_hash_table_lookup (world->timezone_cache, tzid);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]