From 6168f7ef3445f0b57dbde9e4890a90779658f6dc Mon Sep 17 00:00:00 2001 From: Ben Hardill Date: Wed, 19 Apr 2017 15:21:05 +0100 Subject: [PATCH] Add extra check for empty results in discovery (#304) --- hardware/wemo/lib/wemo.js | 2 +- hardware/wemo/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/hardware/wemo/lib/wemo.js b/hardware/wemo/lib/wemo.js index a2ae24ef..a042bfd0 100644 --- a/hardware/wemo/lib/wemo.js +++ b/hardware/wemo/lib/wemo.js @@ -123,7 +123,7 @@ WeMoNG.prototype.start = function start() { request.get(location.href, function(err, res, xml) { if (!err) { xml2js.parseString(xml, function(err, json) { - if (!err && json) { + if (!err && json && json.root) { var device = { ip: location.hostname, port: location.port }; for (var key in json.root.device[0]) { device[key] = json.root.device[0][key][0]; diff --git a/hardware/wemo/package.json b/hardware/wemo/package.json index 9ba06250..70d2e368 100644 --- a/hardware/wemo/package.json +++ b/hardware/wemo/package.json @@ -1,6 +1,6 @@ { "name": "node-red-node-wemo", - "version": "0.1.11", + "version": "0.1.12", "description": "Input and Output nodes for Belkin WeMo devices", "repository": "https://github.com/node-red/node-red-nodes/tree/master/hardware", "main": "WeMoNG.js",