From 476532af5427e5658e9b6a93381bde4f70850356 Mon Sep 17 00:00:00 2001 From: Zaid Abdulla Date: Mon, 22 Oct 2018 15:45:09 -0700 Subject: [PATCH] Fix crash when declare timestamps are missing --- lib/session.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/session.js b/lib/session.js index b4e2b12..e54a157 100644 --- a/lib/session.js +++ b/lib/session.js @@ -1016,9 +1016,12 @@ function rpcRequest(sessionContext, _declarations, callback) { // Enforce max timestamp if (d.pathGet > sessionContext.timestamp) d.pathGet = sessionContext.timestamp; - for (const [k, v] of Object.entries(d.attrGet)) { - if (v > sessionContext.timestamp) - d.attrGet[k] = sessionContext.timestamp; + + if (d.attrGet) { + for (const [k, v] of Object.entries(d.attrGet)) { + if (v > sessionContext.timestamp) + d.attrGet[k] = sessionContext.timestamp; + } } for (const ad of device.getAliasDeclarations(d.path, 1))