diff options
author | Bastien Nocera <hadess@hadess.net> | 2018-03-08 12:25:12 +0100 |
---|---|---|
committer | Bastien Nocera <hadess@hadess.net> | 2018-03-09 12:10:37 +0100 |
commit | 7a313a8b372064a22bd40e82533fe4e9a387d75b (patch) | |
tree | 764e517885df0c61eccf6e4347b6ff0c2374359f | |
parent | 567211986b53c443897fbe0ab559b7200516f37e (diff) | |
download | libgweather-7a313a8b372064a22bd40e82533fe4e9a387d75b.tar.gz |
GWeatherLocation: Warn for locations without coords
Warn when trying to get distance between 2 locations and one of them has
no coordinates.
https://bugzilla.gnome.org/show_bug.cgi?id=792328
-rw-r--r-- | libgweather/gweather-location.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/libgweather/gweather-location.c b/libgweather/gweather-location.c index a35f3a2..9c51c1b 100644 --- a/libgweather/gweather-location.c +++ b/libgweather/gweather-location.c @@ -936,11 +936,11 @@ gweather_location_get_coords (GWeatherLocation *loc, double gweather_location_get_distance (GWeatherLocation *loc, GWeatherLocation *loc2) { - g_return_val_if_fail (loc != NULL, 0); - g_return_val_if_fail (loc2 != NULL, 0); + g_return_val_if_fail (loc != NULL, G_MAXDOUBLE); + g_return_val_if_fail (loc2 != NULL, G_MAXDOUBLE); - //g_return_val_if_fail (loc->latlon_valid, 0.0); - //g_return_val_if_fail (loc2->latlon_valid, 0.0); + g_return_val_if_fail (loc->latlon_valid, G_MAXDOUBLE); + g_return_val_if_fail (loc2->latlon_valid, G_MAXDOUBLE); return location_distance (loc->latitude, loc->longitude, loc2->latitude, loc2->longitude); |