From 0ccf19e9e824224689e6efe1b8d96497714155aa Mon Sep 17 00:00:00 2001 From: None Date: Wed, 8 Apr 2015 00:22:46 +0200 Subject: [PATCH] Guard for incorrect coordinates, that can not be split at ",", avoids error with old locations. --- src/openweathermap_org.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/openweathermap_org.js b/src/openweathermap_org.js index d814078..3059f90 100644 --- a/src/openweathermap_org.js +++ b/src/openweathermap_org.js @@ -373,6 +373,9 @@ function parseWeatherCurrent() { function refreshWeatherCurrent() { this.oldLocation = this.extractCoord(this._city); + if (this.oldLocation.search(",") == -1) + return; + let params = { lat: this.oldLocation.split(",")[0], lon: this.oldLocation.split(",")[1], @@ -448,6 +451,9 @@ function refreshWeatherForecast() { this.oldLocation = this.extractCoord(this._city); + if (this.oldLocation.search(",") == -1) + return; + let params = { lat: this.oldLocation.split(",")[0], lon: this.oldLocation.split(",")[1],