diff --git a/nodes/xilica-listen.html b/nodes/xilica-listen.html index bb08c5c..58f364f 100644 --- a/nodes/xilica-listen.html +++ b/nodes/xilica-listen.html @@ -19,6 +19,16 @@ RED.nodes.registerType('xilica-listen', { oneditprepare: function () { var node = this; var rules = node.rules || []; + if (typeof rules === "string") { + try { + rules = JSON.parse(rules); + } catch (e) { + rules = []; + } + } + if (!Array.isArray(rules)) { + rules = []; + } $("#node-input-rules").editableList({ addItem: function (container, index, rule) { diff --git a/nodes/xilica-subscribe.html b/nodes/xilica-subscribe.html index 5ca36e5..7244690 100644 --- a/nodes/xilica-subscribe.html +++ b/nodes/xilica-subscribe.html @@ -22,6 +22,16 @@ RED.nodes.registerType('xilica-subscribe', { oneditprepare: function () { var node = this; var rules = node.rules || []; + if (typeof rules === "string") { + try { + rules = JSON.parse(rules); + } catch (e) { + rules = []; + } + } + if (!Array.isArray(rules)) { + rules = []; + } $("#node-input-rules").editableList({ addItem: function (container, index, rule) {