🐛 Fix issue with referencing values before loops

This commit is contained in:
Jan Oberhauser 2021-08-19 18:29:20 +02:00
parent 6bc3a20591
commit 7da86641d5

View file

@ -635,6 +635,17 @@ export class Workflow {
* @memberof Workflow
*/
getNodeConnectionOutputIndex(nodeName: string, parentNodeName: string, type = 'main', depth = -1, checkedNodes?: string[]): number | undefined {
const node = this.getNode(parentNodeName);
if (node === null) {
return undefined;
}
const nodeType = this.nodeTypes.getByName(node.type) as INodeType;
if (nodeType.description.outputs.length === 1) {
// If the parent node has only one output, it can only be connected
// to that one. So no further checking is required.
return 0;
}
depth = depth === -1 ? -1 : depth;
const newDepth = depth === -1 ? depth : depth - 1;
if (depth === 0) {
@ -669,8 +680,8 @@ export class Workflow {
}
if (checkedNodes!.includes(connection.node)) {
// Node got checked already before
return;
// Node got checked already before so continue with the next one
continue;
}
outputIndex = this.getNodeConnectionOutputIndex(connection.node, parentNodeName, type, newDepth, checkedNodes);