Fix crash when declare timestamps are missing

This commit is contained in:
Zaid Abdulla committed 2018-10-22 15:45:09 -07:00
1 parent 1a56915d4b
commit 476532af54
1 file changed
+6 -3
+6 -3
View File
@@ -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))