tyrrellsystems / node-red-contrib-serial-modbus

This node is now maintained from @leifnel's fork
https://github.com/leifnel/node-red-contrib-serial-modbus
Apache License 2.0
7 stars 13 forks source link

Node stops working if request with callback fails #14

Closed jonasgreen88 closed 7 years ago

jonasgreen88 commented 7 years ago

If a Modbus request fails (e.g. timed out) and it has a callback to be processed upon receiving a response the node will stop working because the data variable is undefined in this case.

hardillb commented 7 years ago

We could probably get away with just:

if (data) {

Rather than

if (typeof data !== 'undefined') {

But that looks good.