From 61b31e9b38bb2065d24a6c7265c55de3e127d5c7 Mon Sep 17 00:00:00 2001 From: None Date: Mon, 29 Jun 2015 00:57:14 +0200 Subject: [PATCH] Notify user, if the coordinates are invalid. --- src/extension.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/extension.js b/src/extension.js index 3a5118a..77dff4b 100644 --- a/src/extension.js +++ b/src/extension.js @@ -880,12 +880,17 @@ const OpenweatherMenuButton = new Lang.Class({ }, extractCoord: function() { - if (!arguments[0]) - return 0; + let coords = 0; - if (arguments[0].search(">") == -1) + if (arguments[0] && (arguments[0].search(">") != -1)) + coords = arguments[0].split(">")[0]; + + if ((coords.search(",") == -1) || isNaN(coords.split(",")[0]) || isNaN(coords.split(",")[1])) { + Main.notify("Openweathermap", _("Invalid location, please try to recreate it")); return 0; - return arguments[0].split(">")[0]; + } + + return coords; }, _onPreferencesActivate: function() {