[libgweather/wip/hadess/fix-serialising-deserialising: 1/2] GWeatherLocation: Fix deserialising a serialised location
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgweather/wip/hadess/fix-serialising-deserialising: 1/2] GWeatherLocation: Fix deserialising a serialised location
- Date: Wed, 20 Mar 2019 14:30:21 +0000 (UTC)
commit a443538620ec9a01c46b7eb4ac126e53a1fc6b0e
Author: Bastien Nocera <hadess hadess net>
Date: Wed Mar 20 15:19:43 2019 +0100
GWeatherLocation: Fix deserialising a serialised location
When the serialised location doesn't contain a weather station code,
gweather_location_deserialize() would fail. Make sure to create a new
detached location from it.
Closes: #18
libgweather/gweather-location.c | 3 +++
1 file changed, 3 insertions(+)
---
diff --git a/libgweather/gweather-location.c b/libgweather/gweather-location.c
index 6db89a1..24a5b60 100644
--- a/libgweather/gweather-location.c
+++ b/libgweather/gweather-location.c
@@ -1513,6 +1513,9 @@ gweather_location_common_deserialize (GWeatherLocation *world,
GList *candidates, *l;
GWeatherLocation *found;
+ if (station_code[0] == '\0')
+ return _gweather_location_new_detached (NULL, name, latlon_valid, latitude, longitude);
+
/* First find the list of candidate locations */
candidates = g_hash_table_lookup (world->metar_code_cache, station_code);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]