Add missing check

This commit is contained in:
Petko Bordjukov 2015-07-04 19:19:35 +03:00
parent 3e53933911
commit 8e6238c014
1 changed files with 1 additions and 1 deletions

View File

@ -21,7 +21,7 @@ function Schedule() {
this.currentEvent = function() { this.currentEvent = function() {
var latestEvent = _.last(this.pastEvents()); var latestEvent = _.last(this.pastEvents());
var nextEvent = this.nextEvent(); 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; return latestEvent;
} else { } else {
return undefined; return undefined;