1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Ensure node wires array is not longer than outputs value

Fixes #1678
This commit is contained in:
Nick O'Leary 2018-04-16 13:23:36 +01:00
parent 9f703de5ec
commit f4c2938b41
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9

View File

@ -753,7 +753,7 @@ RED.nodes = (function() {
if (!isInitialLoad && unknownTypes.length > 0) { if (!isInitialLoad && unknownTypes.length > 0) {
var typeList = "<ul><li>"+unknownTypes.join("</li><li>")+"</li></ul>"; var typeList = "<ul><li>"+unknownTypes.join("</li><li>")+"</li></ul>";
var type = "type"+(unknownTypes.length > 1?"s":""); var type = "type"+(unknownTypes.length > 1?"s":"");
RED.notify("<strong>"+RED._("clipboard.importUnrecognised",{count:unknownTypes.length})+"</strong>"+typeList,"error",false,10000); RED.notify("<p>"+RED._("clipboard.importUnrecognised",{count:unknownTypes.length})+"</p>"+typeList,"error",false,10000);
} }
var activeWorkspace = RED.workspaces.active(); var activeWorkspace = RED.workspaces.active();
@ -1033,6 +1033,11 @@ RED.nodes = (function() {
if (node._def.category != "config") { if (node._def.category != "config") {
node.inputs = n.inputs||node._def.inputs; node.inputs = n.inputs||node._def.inputs;
node.outputs = n.outputs||node._def.outputs; node.outputs = n.outputs||node._def.outputs;
// If 'wires' is longer than outputs, clip wires
if (node.hasOwnProperty('wires') && node.wires.length > node.outputs) {
node.wires = node.wires.slice(0,node.outputs);
wireClippedNodes.push(node);
}
for (d in node._def.defaults) { for (d in node._def.defaults) {
if (node._def.defaults.hasOwnProperty(d)) { if (node._def.defaults.hasOwnProperty(d)) {
node[d] = n[d]; node[d] = n[d];