From 7da9bb80ddfab74d9a91145cbd4bf62d34d92097 Mon Sep 17 00:00:00 2001 From: Philippe Troin Date: Fri, 24 May 2019 14:54:51 -0700 Subject: [PATCH] Handle missing wind data in OpenWeather provider. Fixes: JS WARNING: [/usr/share/gnome-shell/extensions/openweather-extension@jenslody.de/openweathermap_org.js 381]: reference to undefined property "deg" JS WARNING: [/usr/share/gnome-shell/extensions/openweather-extension@jenslody.de/extension.js 1171]: reference to undefined property "NaN" --- src/openweathermap_org.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/openweathermap_org.js b/src/openweathermap_org.js index 20e1dbc..a9e0d08 100644 --- a/src/openweathermap_org.js +++ b/src/openweathermap_org.js @@ -378,7 +378,11 @@ function parseWeatherCurrent() { this._currentWeatherSunrise.text = sunrise; this._currentWeatherSunset.text = sunset; this._currentWeatherBuild.text = lastBuild; - this._currentWeatherWind.text = this.formatWind(json.wind.speed, this.getWindDirection(json.wind.deg)); + if (json.wind != undefined && json.wind.deg != undefined) { + this._currentWeatherWind.text = this.formatWind(json.wind.speed, this.getWindDirection(json.wind.deg)); + } else { + this._currentWeatherWind.text = _("?"); + } this.parseWeatherForecast(); this.recalcLayout();