From 6d8c35586931ed6bc41d9631b80fe1b2b363fda5 Mon Sep 17 00:00:00 2001 From: Samer Albahra Date: Thu, 24 May 2018 08:20:19 -0500 Subject: [PATCH] Handle no valid data states --- routes/weather.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/routes/weather.js b/routes/weather.js index 653f162..f22e381 100755 --- a/routes/weather.js +++ b/routes/weather.js @@ -430,7 +430,12 @@ exports.getWeather = function( req, res ) { // and also calculate if a restriction is met to prevent watering. finishRequest = function( weather ) { if ( !weather ) { - getTimeData( location, finishRequest ); + if ( typeof location[ 0 ] === "number" && typeof location[ 1 ] === "number" ) { + getTimeData( location, finishRequest ); + } else { + res.send( "Error: No weather data found." ); + } + return; }