njh / node-owfs

A node.js client library for the owserver protocol in owfs
https://www.npmjs.com/package/owfs
MIT License
10 stars 4 forks source link

Fix exception "cannot read property payload from undefined" #12

Closed Giermann closed 9 years ago

Giermann commented 9 years ago

Unfortunatly I cannot verfy if my coffee syntax is right, but I tried hard to code it right... I changed my copy in build, which I didn't upload here, since "build" is only the result of coffee.

Without this fix, users randomly reported the given exception. Checking the code I found, that only return of an explicit error or the presence of more than 1 messages is being handled. Return of 0 messages without error would have lead to the exception.

You might consider to increase the version number after applying the patch ;)

Giermann commented 9 years ago

Sorry, a stupid copy&paste error - of course we have to check 'messageToUse' to have a lenght greater than 0!