Add a guard to check if wires exist

This commit is contained in:
GogoVega 2024-11-25 21:07:42 +01:00
parent a743764345
commit 6194285b6e
No known key found for this signature in database
GPG Key ID: E1E048B63AC5AC2B

View File

@ -2336,6 +2336,7 @@ 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 (node.hasOwnProperty('wires'))
if (isNaN(node.outputs)) {
node.outputs = node.wires.length;
} else if (node.wires.length > node.outputs) {
@ -2343,6 +2344,7 @@ RED.nodes = (function() {
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) {
if (node._def.defaults.hasOwnProperty(d) && d !== 'inputs' && d !== 'outputs') {