From 8ec2a12a606744182aaf37ee23137b3c0b657507 Mon Sep 17 00:00:00 2001 From: Marat Fayzullin Date: Mon, 5 Dec 2022 23:19:02 -0500 Subject: [PATCH] Fixing no-wind situation. --- htdocs/map.js | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/htdocs/map.js b/htdocs/map.js index 623450b..a0be65f 100644 --- a/htdocs/map.js +++ b/htdocs/map.js @@ -453,15 +453,17 @@ $(function(){ weatherString += makeListItem('Pressure', marker.weather.barometricpressure.toFixed(1) + ' mbar'); } - if (marker.weather.wind && (marker.weather.wind.speed>0)) { - weatherString += makeListItem('Wind', - degToCompass(marker.weather.wind.direction) + ' ' + - marker.weather.wind.speed.toFixed(1) + ' km/h ' - ); - } + if (marker.weather.wind) { + if (marker.weather.wind.speed && (marker.weather.wind.speed>0)) { + weatherString += makeListItem('Wind', + degToCompass(marker.weather.wind.direction) + ' ' + + marker.weather.wind.speed.toFixed(1) + ' km/h ' + ); + } - if (marker.weather.wind.gust && (marker.weather.wind.gust>0)) { - weatherString += makeListItem('Gusts', marker.weather.wind.gust.toFixed(1) + ' km/h'); + if (marker.weather.wind.gust && (marker.weather.wind.gust>0)) { + weatherString += makeListItem('Gusts', marker.weather.wind.gust.toFixed(1) + ' km/h'); + } } if (marker.weather.rain && (marker.weather.rain.day>0)) {