From 6194285b6eb26b0abcb9347209034ddedb46a48e Mon Sep 17 00:00:00 2001 From: GogoVega <92022724+GogoVega@users.noreply.github.com> Date: Mon, 25 Nov 2024 21:07:42 +0100 Subject: [PATCH] Add a guard to check if wires exist --- .../@node-red/editor-client/src/js/nodes.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/packages/node_modules/@node-red/editor-client/src/js/nodes.js b/packages/node_modules/@node-red/editor-client/src/js/nodes.js index f7b61f3a6..e3df86f6c 100644 --- a/packages/node_modules/@node-red/editor-client/src/js/nodes.js +++ b/packages/node_modules/@node-red/editor-client/src/js/nodes.js @@ -2336,12 +2336,14 @@ RED.nodes = (function() { // The node declares outputs in its defaults, but has not got a valid value // Defer to the length of the wires array - if (isNaN(node.outputs)) { - node.outputs = node.wires.length; - } else if (node.wires.length > node.outputs) { - // If 'wires' is longer than outputs, clip wires - console.log("Warning: node.wires longer than node.outputs - trimming wires:", node.id, " wires:", node.wires.length, " outputs:", node.outputs); - node.wires = node.wires.slice(0, node.outputs); + if (node.hasOwnProperty('wires')) + if (isNaN(node.outputs)) { + node.outputs = node.wires.length; + } else if (node.wires.length > node.outputs) { + // If 'wires' is longer than outputs, clip wires + console.log("Warning: node.wires longer than node.outputs - trimming wires:", node.id, " wires:", node.wires.length, " outputs:", node.outputs); + node.wires = node.wires.slice(0, node.outputs); + } } for (d in node._def.defaults) {