From 76acc76f0f90e12de94be49caa523c093728c8eb Mon Sep 17 00:00:00 2001 From: Samer Albahra Date: Fri, 7 Aug 2015 20:34:02 -0500 Subject: [PATCH] Fix bug referencing invalid value from cache --- routes/weather.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/routes/weather.js b/routes/weather.js index f6cde40..a0d110b 100644 --- a/routes/weather.js +++ b/routes/weather.js @@ -119,7 +119,9 @@ function getWxWeatherData( location, callback ) { key: "yesterdayHumidity", location: location }, function( record ) { - weather.yesterdayHumidity = record.yesterdayHumidity; + if ( record ) { + weather.yesterdayHumidity = record.yesterdayHumidity; + } // Return the data to the callback function if successful callback( weather ); @@ -167,7 +169,9 @@ function getWeatherData( location, callback ) { key: "yesterdayHumidity", location: location }, function( record ) { - weather.yesterdayHumidity = record.yesterdayHumidity; + if ( record ) { + weather.yesterdayHumidity = record.yesterdayHumidity; + } // Return the data to the callback function if successful callback( weather );