Guard for incorrect coordinates, that can not be split at ",", avoids error with old locations.

merge-requests/218/head
None 10 years ago
parent 86bf9678b0
commit 0ccf19e9e8
  1. 6
      src/openweathermap_org.js

@ -373,6 +373,9 @@ function parseWeatherCurrent() {
function refreshWeatherCurrent() { function refreshWeatherCurrent() {
this.oldLocation = this.extractCoord(this._city); this.oldLocation = this.extractCoord(this._city);
if (this.oldLocation.search(",") == -1)
return;
let params = { let params = {
lat: this.oldLocation.split(",")[0], lat: this.oldLocation.split(",")[0],
lon: this.oldLocation.split(",")[1], lon: this.oldLocation.split(",")[1],
@ -448,6 +451,9 @@ function refreshWeatherForecast() {
this.oldLocation = this.extractCoord(this._city); this.oldLocation = this.extractCoord(this._city);
if (this.oldLocation.search(",") == -1)
return;
let params = { let params = {
lat: this.oldLocation.split(",")[0], lat: this.oldLocation.split(",")[0],
lon: this.oldLocation.split(",")[1], lon: this.oldLocation.split(",")[1],

Loading…
Cancel
Save