File tree Expand file tree Collapse file tree 1 file changed +28
-5
lines changed Expand file tree Collapse file tree 1 file changed +28
-5
lines changed Original file line number Diff line number Diff line change @@ -1748,11 +1748,34 @@ export class LGraph
17481748 this . subgraphs . delete ( subgraphNode . subgraph . id )
17491749 const linkIdMap = new Map < LinkId , LinkId [ ] > ( )
17501750 for ( const newLink of newLinks ) {
1751- const created = this . _nodes_by_id [ newLink [ 0 ] ] . connect (
1752- newLink [ 1 ] ,
1753- this . _nodes_by_id [ newLink [ 2 ] ] ,
1754- newLink [ 3 ]
1755- )
1751+ let created : LLink | null | undefined
1752+ if ( newLink [ 0 ] == SUBGRAPH_INPUT_ID ) {
1753+ if ( ! ( this instanceof Subgraph ) ) {
1754+ console . error ( 'Ignoring link to subgraph outside subgraph' )
1755+ continue
1756+ }
1757+ const tnode = this . _nodes_by_id [ newLink [ 2 ] ]
1758+ created = this . inputNode . slots [ newLink [ 1 ] ] . connect (
1759+ tnode . inputs [ newLink [ 3 ] ] ,
1760+ tnode
1761+ )
1762+ } else if ( newLink [ 2 ] == SUBGRAPH_OUTPUT_ID ) {
1763+ if ( ! ( this instanceof Subgraph ) ) {
1764+ console . error ( 'Ignoring link to subgraph outside subgraph' )
1765+ continue
1766+ }
1767+ const tnode = this . _nodes_by_id [ newLink [ 0 ] ]
1768+ created = this . outputNode . slots [ newLink [ 3 ] ] . connect (
1769+ tnode . outputs [ newLink [ 1 ] ] ,
1770+ tnode
1771+ )
1772+ } else {
1773+ created = this . _nodes_by_id [ newLink [ 0 ] ] . connect (
1774+ newLink [ 1 ] ,
1775+ this . _nodes_by_id [ newLink [ 2 ] ] ,
1776+ newLink [ 3 ]
1777+ )
1778+ }
17561779 if ( ! created ) {
17571780 console . error ( 'Failed to create link' )
17581781 continue
You can’t perform that action at this time.
0 commit comments