From b4dd8e0f245eaae66abf04b45dfbdedc22a41c2e Mon Sep 17 00:00:00 2001 From: Jey Cee Date: Tue, 1 Oct 2024 15:02:40 +0200 Subject: [PATCH] Catch possible error --- main.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/main.js b/main.js index f122a2b..70e4472 100755 --- a/main.js +++ b/main.js @@ -1407,6 +1407,8 @@ function setNewState(state, serviceID, data, cb) { let newStates2 = JSON.stringify(newStates) || ''; + console.log(newStates2); + // TODO: Must be refactored if (newStates2 === undefined){ adapter.log.info('State: ' + state + ' Service ID: ' + serviceID + ' Data: ' + JSON.stringify(data)); @@ -1622,7 +1624,9 @@ function sendCommand(id, cb) { id = id.replace('.request', ''); adapter.getObject(service, (err, obj) => { - + if(obj === null) { + return; + } let vServiceType = obj.native.serviceType; let serviceName = obj.native.name; let device = service.replace(`.${serviceName}`, ''); @@ -1787,7 +1791,6 @@ function createMessage(sType, aName, _ip, _port, cURL, body, actionID, cb) { let foundData = body.match(/<[^\/]\w*\s*[^<]*/g); if (foundData) { actionID = actionID.replace(/\.request$/, ''); - for (let i = foundData.length - 1; i >= 0; i--) { let foundArgName = foundData[i].match(/<\w*>/); let strFoundArgName;