deviceInfo.recent null check (#3048)

This commit is contained in:
Scott Leibrand
2017-11-28 18:34:42 +02:00
committed by Sulka Haro
parent 2f67610577
commit d0f94d9a75
+1 -1
View File
@@ -209,7 +209,7 @@ function init (ctx) {
_.forEach(delta.previous.sgvs, function deviceAndValue(entry) {
var device = utils.deviceName(entry.device);
var deviceInfo = deviceInfos[device];
if (deviceInfo) {
if (deviceInfo && deviceInfo.recent) {
var deviceDelta = bgnow.calcDelta(
{ mills: deviceInfo.recent.mills , mean: deviceInfo.recent.mgdl}
, { mills: entry.mills, mean: entry.mgdl}