File tree Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -330,9 +330,12 @@ def _applyExpr(self):
330330 elif self .isInput and Attribute .isLinkExpression (v ):
331331 # value is a link to another attribute
332332 link = v [1 :- 1 ]
333- linkNode , linkAttr = link .split ('.' )
333+ linkNodeName , linkAttrName = link .split ('.' )
334334 try :
335- g .addEdge (g .node (linkNode ).attribute (linkAttr ), self )
335+ node = g .node (linkNodeName )
336+ if not node :
337+ raise KeyError (f"Node '{ linkNodeName } ' not found" )
338+ g .addEdge (node .attribute (linkAttrName ), self )
336339 except KeyError as err :
337340 logging .warning ('Connect Attribute from Expression failed.' )
338341 logging .warning ('Expression: "{exp}"\n Error: "{err}".' .format (exp = v , err = err ))
Original file line number Diff line number Diff line change @@ -336,3 +336,15 @@ def test_nodeWithoutVersionInfoIsUpgraded(self):
336336 assert len (graph .nodes ) == 1
337337 assert len (graph .compatibilityNodes ) == 0
338338
339+ def test_connectionsToMissingNodesAreDiscarded (self ):
340+ graph = Graph ("" )
341+
342+ with registeredNodeTypes ([SimpleNode ]):
343+ sampleGraphContent = dedent ("""
344+ {
345+ "SimpleNode_1": {
346+ "nodeType": "SimpleNode", "inputs": { "input": "{NotSerializedNode.output}" }
347+ }
348+ }
349+ """ )
350+ graph ._deserialize (json .loads (sampleGraphContent ))
You can’t perform that action at this time.
0 commit comments