[libgweather/wip/hadess/fix-utc-sunrise: 2/4] weather: Fix infinite loop for location without a valid long/lat



commit e6093d85a0f877ab91b80b3a983b6527549b89c9
Author: Bastien Nocera <hadess hadess net>
Date:   Mon Oct 8 12:25:20 2018 +0200

    weather: Fix infinite loop for location without a valid long/lat
    
    Don't try to calculate the sunset/sunrise times for GWeatherLocations
    without a valid long/lat, such as named timezones.
    
    Closes: #5

 libgweather/weather-sun.c | 3 +++
 1 file changed, 3 insertions(+)
---
diff --git a/libgweather/weather-sun.c b/libgweather/weather-sun.c
index d7983b1..e3960f1 100644
--- a/libgweather/weather-sun.c
+++ b/libgweather/weather-sun.c
@@ -293,6 +293,9 @@ _gweather_info_ensure_sun (GWeatherInfo *info)
 
     priv = info->priv;
 
+    if (!info->priv->location.latlon_valid)
+        return;
+
     if (!priv->sunriseValid && !priv->sunsetValid)
        calc_sun (info, priv->current_time);
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]