zigbeer / zigbee-shepherd

An open source ZigBee gateway solution with node.js.
MIT License
250 stars 89 forks source link

Crash on message recieved before ready #21

Open remijn opened 7 years ago

remijn commented 7 years ago

When a message is received before the coordinator is ready, shepherd crashes with this error

zigbee-shepherd:request RSP <-- SYS:osalNvRead, status: 0 +163ms zigbee-shepherd:request REQ --> SAPI:readConfiguration +12ms zigbee-shepherd:request RSP <-- SAPI:readConfiguration, status: 0 +23ms /Users/nick/Programming/zigbee-shepherd/lib/components/af.js:530 targetEp = af.controller.getCoord().getEndpoint(msg.dstendpoint); // => find local ep ^

TypeError: Cannot read property 'getEndpoint' of null at dispatchIncomingMsg (/Users/nick/Programming/zigbee-shepherd/lib/components/af.js:530:44) at Controller.incomingMsgHandler (/Users/nick/Programming/zigbee-shepherd/lib/components/af.js:663:12) at emitOne (events.js:77:13) at Controller.emit (events.js:169:7) at Object.bridge._areqEventBridge (/Users/nick/Programming/zigbee-shepherd/lib/components/event_bridge.js:15:16) at CcZnp. (/Users/nick/Programming/zigbee-shepherd/lib/components/controller.js:98:16) at emitOne (events.js:77:13) at CcZnp.emit (events.js:169:7) at CcZnp._mtIncomingDataHdlr (/Users/nick/Programming/zigbee-shepherd/node_modules/cc-znp/lib/ccznp.js:367:14) at /Users/nick/Programming/zigbee-shepherd/node_modules/cc-znp/lib/ccznp.js:333:22 at nextTickCallbackWith0Args (node.js:489:9) at process._tickCallback (node.js:418:13)