From acbba3b874f587a7d54dc08d9ea3c81d4eb1edaa Mon Sep 17 00:00:00 2001 From: Jason Calabrese Date: Thu, 13 Aug 2015 22:09:54 -0700 Subject: [PATCH] minor fix for possible error when treatment data is missing --- lib/plugins/treatmentnotify.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/plugins/treatmentnotify.js b/lib/plugins/treatmentnotify.js index 5a71e05cb28..32143e5ec93 100644 --- a/lib/plugins/treatmentnotify.js +++ b/lib/plugins/treatmentnotify.js @@ -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; }