From 8e6238c0149abaf8d769afa506058bae76d46751 Mon Sep 17 00:00:00 2001 From: Petko Bordjukov Date: Sat, 4 Jul 2015 19:19:35 +0300 Subject: [PATCH] Add missing check --- schedule.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/schedule.js b/schedule.js index be30e16..d832f58 100644 --- a/schedule.js +++ b/schedule.js @@ -21,7 +21,7 @@ function Schedule() { this.currentEvent = function() { var latestEvent = _.last(this.pastEvents()); var nextEvent = this.nextEvent(); - if (typeof nextEvent != 'undefined' && (latestEvent.displayNext || moment(nextEvent.startTime).subtract('minutes', 10).isAfter(moment()))) { + if (typeof nextEvent != 'undefined' && typeof latestEvent != 'undefined' && (latestEvent.displayNext || moment(nextEvent.startTime).subtract('minutes', 10).isAfter(moment()))) { return latestEvent; } else { return undefined;