[libgweather/wip/hadess/serialisation-fix-stable: 3/13] weather: Don't try to fetch weather for named timezones



commit 0fcab52c37180ef7e27e7cb312df6df1382347c7
Author: Bastien Nocera <hadess hadess net>
Date:   Mon Oct 8 12:28:26 2018 +0200

    weather: Don't try to fetch weather for named timezones
    
    Those would likely fail anyway, so return early.

 libgweather/weather-metar.c | 3 +++
 libgweather/weather-wx.c    | 3 +++
 2 files changed, 6 insertions(+)
---
diff --git a/libgweather/weather-metar.c b/libgweather/weather-metar.c
index 31ef815..b8362da 100644
--- a/libgweather/weather-metar.c
+++ b/libgweather/weather-metar.c
@@ -627,6 +627,9 @@ metar_start_open (GWeatherInfo *info)
     priv->valid = priv->network_error = FALSE;
     loc = &priv->location;
 
+    if (!loc->latlon_valid)
+        return;
+
     msg = soup_form_request_new (
        "GET", "https://www.aviationweather.gov/adds/dataserver_current/httpparam";,
        "dataSource", "metars",
diff --git a/libgweather/weather-wx.c b/libgweather/weather-wx.c
index 2dee559..f1e57d7 100644
--- a/libgweather/weather-wx.c
+++ b/libgweather/weather-wx.c
@@ -86,6 +86,9 @@ wx_start_open (GWeatherInfo *info)
     priv->radar_loader = gdk_pixbuf_loader_new ();
     loc = &priv->location;
 
+    if (!loc->latlon_valid)
+       return;
+
     if (priv->radar_url)
        url = g_strdup (priv->radar_url);
     else {


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