victronenergy / node-red-contrib-victron

MIT License
87 stars 18 forks source link

[BUG] #194

Open Chris927 opened 2 weeks ago

Chris927 commented 2 weeks ago

Given

I'm running a dbus service, which implements GetItems in a somehow non-conformant way.

Observed

The incorrect implementation of GetItems of said service makes the dbus-listener crash in line 158 (dbus-listener, version 1.5.18):

@4000000066713bc72daab644 18 Jun 07:48:13 - [error] TypeError: Cannot read properties of undefined (reading 'forEach')
@4000000066713bc72daadd54     at Object.<anonymous> (/usr/lib/node_modules/@victronenergy/node-red-contrib-victron/src/services/dbus-listener.js:158:1
3)
@4000000066713bc72daaf0dc     at EventEmitter.<anonymous> (/usr/lib/node_modules/@victronenergy/node-red-contrib-victron/node_modules/dbus-native/lib/
bus.js:138:19)
@4000000066713bc72dab0464     at EventEmitter.emit (node:events:529:35)
@4000000066713bc72dab101c     at /usr/lib/node_modules/@victronenergy/node-red-contrib-victron/node_modules/dbus-native/index.js:106:14
@4000000066713bc72dad0034     at Socket.<anonymous> (/usr/lib/node_modules/@victronenergy/node-r

Expected

Should not crash :) ... can simply fix by doing (res || []), which circumvents the crash, but may result in subsequent issues. Please investigate further.