diff --git a/openweather.js b/openweather.js index 24f4ee3..d2e4c8e 100644 --- a/openweather.js +++ b/openweather.js @@ -114,16 +114,16 @@ function onDeltasUpdate(deltas) { if (deltas === null && !Array.isArray(deltas) && deltas.length === 0) { throw "Deltas cannot be null"; } + if (deltas.updates && Array.isArray(deltas.updates)) + deltas.updates.forEach(u => { + u.values.forEach((value) => { + let onDeltaUpdated = subscriptionHandler.find((d) => d.path === value.path); - deltas.updates.forEach(u => { - u.values.forEach((value) => { - let onDeltaUpdated = subscriptionHandler.find((d) => d.path === value.path); - - if (onDeltaUpdated !== null) { - onDeltaUpdated.handle(value.value); - } + if (onDeltaUpdated !== null) { + onDeltaUpdated.handle(value.value); + } + }); }); - }); } function onPositionUpdate(value) { diff --git a/package.json b/package.json index 5befb2b..d307bda 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "openweather-signalk", - "version": "0.8.0", + "version": "0.8.1", "description": "SignalK plugin to provide data from OpenWeather Service", "main": "index.js", "scripts": {