diff --git a/ts/base_any_input_connected_node.ts b/ts/base_any_input_connected_node.ts index 8f866b5..c4cd873 100644 --- a/ts/base_any_input_connected_node.ts +++ b/ts/base_any_input_connected_node.ts @@ -286,10 +286,12 @@ LGraphNode.prototype.connectByType = function connectByType( optsIn: string): T | null { // If we're droppiong on a node, and the last input is free and an "*" type, then connect there // first... - for (const [index, input] of sourceNode.inputs.entries()) { - if (!input.link && input.type === '*') { - this.connect(slot, sourceNode, index); - return null; + if (sourceNode.inputs) { + for (const [index, input] of sourceNode.inputs.entries()) { + if (!input.link && input.type === '*') { + this.connect(slot, sourceNode, index); + return null; + } } } return (oldLGraphNodeConnectByType && oldLGraphNodeConnectByType.call(this, slot, sourceNode, sourceSlotType, optsIn) || null) as T; diff --git a/web/base_any_input_connected_node.js b/web/base_any_input_connected_node.js index a25e11f..1ea490f 100644 --- a/web/base_any_input_connected_node.js +++ b/web/base_any_input_connected_node.js @@ -160,10 +160,12 @@ export class BaseAnyInputConnectedNode extends RgthreeBaseNode { } const oldLGraphNodeConnectByType = LGraphNode.prototype.connectByType; LGraphNode.prototype.connectByType = function connectByType(slot, sourceNode, sourceSlotType, optsIn) { - for (const [index, input] of sourceNode.inputs.entries()) { - if (!input.link && input.type === '*') { - this.connect(slot, sourceNode, index); - return null; + if (sourceNode.inputs) { + for (const [index, input] of sourceNode.inputs.entries()) { + if (!input.link && input.type === '*') { + this.connect(slot, sourceNode, index); + return null; + } } } return (oldLGraphNodeConnectByType && oldLGraphNodeConnectByType.call(this, slot, sourceNode, sourceSlotType, optsIn) || null);