From ce1d0a4e967af91583513123c272dbae46025f90 Mon Sep 17 00:00:00 2001 From: David Peer Date: Fri, 11 Feb 2022 07:55:05 +0100 Subject: [PATCH] Minor fix. --- apps/lcars/lcars.app.js | 46 ++++++++++++++++++++--------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/apps/lcars/lcars.app.js b/apps/lcars/lcars.app.js index e1ac0cb97..bc797b1cf 100644 --- a/apps/lcars/lcars.app.js +++ b/apps/lcars/lcars.app.js @@ -482,31 +482,31 @@ function getWeather(){ // Return default } - if(weatherJson){ - var weather = weatherJson.weather; - - // Temperature - const temp = locale.temp(weather.temp-273.15).match(/^(\D*\d*)(.*)$/); - weather.temp = temp[1] + " " + temp[2].toUpperCase(); - - // Humidity - weather.hum = weather.hum + "%"; - - // Wind - const wind = locale.speed(weather.wind).match(/^(\D*\d*)(.*)$/); - weather.wind = wind[1] + wind[2].toUpperCase(); - - return weather + if(weatherJson === undefined){ + return { + temp: "-", + hum: "-", + txt: "-", + wind: "-", + wdir: "-", + wrose: "-" + }; } - return { - temp: "-", - hum: "-", - txt: "-", - wind: "-", - wdir: "-", - wrose: "-" - }; + var weather = weatherJson.weather; + + // Temperature + const temp = locale.temp(weather.temp-273.15).match(/^(\D*\d*)(.*)$/); + weather.temp = temp[1] + " " + temp[2].toUpperCase(); + + // Humidity + weather.hum = weather.hum + "%"; + + // Wind + const wind = locale.speed(weather.wind).match(/^(\D*\d*)(.*)$/); + weather.wind = wind[1]; // + wind[2].toUpperCase(); // Don't show mph - its too large + + return weather }