summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Nocera <hadess@hadess.net>2018-03-08 12:21:37 +0100
committerBastien Nocera <hadess@hadess.net>2018-03-09 12:10:37 +0100
commitff5b56aacdaf1174049b8930284d2d5cbaffc558 (patch)
tree97609143042a03291bc1a679d607a34995194141
parent634658723adddd549c22ff2ebdb6025474d220ae (diff)
downloadlibgweather-ff5b56aacdaf1174049b8930284d2d5cbaffc558.tar.gz
GWeatherLocation: Don't try to get distance to elements without coords
Skip over elements that don't have valid coordinates when trying to find the closest weather station, as that would have returned incorrect values. https://bugzilla.gnome.org/show_bug.cgi?id=792328
-rw-r--r--libgweather/gweather-location.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/libgweather/gweather-location.c b/libgweather/gweather-location.c
index 70d1ada..a35f3a2 100644
--- a/libgweather/gweather-location.c
+++ b/libgweather/gweather-location.c
@@ -157,6 +157,10 @@ add_nearest_weather_station (GWeatherLocation *location)
if (siblings[i] == location)
continue;
+ /* Skip siblings without valid coordinates */
+ if (!siblings[i]->latlon_valid)
+ continue;
+
distance = gweather_location_get_distance (location, siblings[i]);
if (distance < min_distance)
closest = siblings[i];