mirror of
https://github.com/alicevision/Meshroom.git
synced 2025-05-21 13:06:28 +02:00
[core] Handle missing link nodes when deserializing edges
Avoid uncaught errors when deserializing edges in case linked nodes are missing. Handle missing nodes the same way missing attributes are dealt with.
This commit is contained in:
parent
87fbcee06d
commit
25094ac877
2 changed files with 17 additions and 2 deletions
|
@ -339,9 +339,12 @@ class Attribute(BaseObject):
|
|||
elif self.isInput and Attribute.isLinkExpression(v):
|
||||
# value is a link to another attribute
|
||||
link = v[1:-1]
|
||||
linkNode, linkAttr = link.split('.')
|
||||
linkNodeName, linkAttrName = link.split('.')
|
||||
try:
|
||||
g.addEdge(g.node(linkNode).attribute(linkAttr), self)
|
||||
node = g.node(linkNodeName)
|
||||
if not node:
|
||||
raise KeyError(f"Node '{linkNodeName}' not found")
|
||||
g.addEdge(node.attribute(linkAttrName), self)
|
||||
except KeyError as err:
|
||||
logging.warning('Connect Attribute from Expression failed.')
|
||||
logging.warning('Expression: "{exp}"\nError: "{err}".'.format(exp=v, err=err))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue