Skip to content

Commit

Permalink
minor fix for possible error when treatment data is missing
Browse files Browse the repository at this point in the history
  • Loading branch information
jasoncalabrese committed Aug 14, 2015
1 parent e7f739e commit acbba3b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/plugins/treatmentnotify.js
Expand Up @@ -101,9 +101,11 @@ function init() {
}

function isCurrent(last) {
if (!last) return false;

var now = Date.now();
var lastTime = last ? last.mills : 0;
var ago = (lastTime && lastTime <= now) ? now - lastTime : -1;
var lastTime = last.mills;
var ago = (last.mills <= now) ? now - lastTime : -1;
return ago !== -1 && ago < times.mins(10).msecs;
}

Expand Down

0 comments on commit acbba3b

Please sign in to comment.