mirror of
https://github.com/node-red/node-red.git
synced 2025-03-01 10:36:34 +00:00
Add a guard to check if wires exist
This commit is contained in:
parent
a743764345
commit
6194285b6e
@ -2336,12 +2336,14 @@ RED.nodes = (function() {
|
|||||||
|
|
||||||
// The node declares outputs in its defaults, but has not got a valid value
|
// The node declares outputs in its defaults, but has not got a valid value
|
||||||
// Defer to the length of the wires array
|
// Defer to the length of the wires array
|
||||||
if (isNaN(node.outputs)) {
|
if (node.hasOwnProperty('wires'))
|
||||||
node.outputs = node.wires.length;
|
if (isNaN(node.outputs)) {
|
||||||
} else if (node.wires.length > node.outputs) {
|
node.outputs = node.wires.length;
|
||||||
// If 'wires' is longer than outputs, clip wires
|
} else if (node.wires.length > node.outputs) {
|
||||||
console.log("Warning: node.wires longer than node.outputs - trimming wires:", node.id, " wires:", node.wires.length, " outputs:", node.outputs);
|
// If 'wires' is longer than outputs, clip wires
|
||||||
node.wires = node.wires.slice(0, node.outputs);
|
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) {
|
for (d in node._def.defaults) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user