Guard callbacks.

This commit is contained in:
Koen Kanters 2019-02-02 02:14:31 +01:00
parent dc70840c8a
commit 189c0f360e

View File

@ -248,7 +248,9 @@ class Zigbee {
`failed with error ${error}`); `failed with error ${error}`);
} }
callback(error, rsp); if (callback) {
callback(error, rsp);
}
}; };
if (cmdType === 'functional' && entity.functional) { if (cmdType === 'functional' && entity.functional) {
@ -276,7 +278,9 @@ class Zigbee {
logger.debug(`Successfully pinged ${ieeeAddr}`); logger.debug(`Successfully pinged ${ieeeAddr}`);
} }
cb(error); if (cb) {
cb(error);
}
}); });
setTimeout(() => queueCallback(), delay); setTimeout(() => queueCallback(), delay);