[core] Attribute: avoid accessing member function of an invalid object

This commit is contained in:
Fabien Castan 2019-09-12 15:44:34 +02:00 committed by Yann Lanthony
parent 5f28a8f4ad
commit f1267d7e67
No known key found for this signature in database
GPG key ID: 519FAE6DF7A70642

View file

@ -151,7 +151,9 @@ class Attribute(BaseObject):
@property
def isLink(self):
""" Whether the attribute is a link to another attribute. """
return self.node.graph and self.isInput and self in self.node.graph.edges.keys()
# Note: Need to test self.node.graph.edges before accessing to edges.keys() to avoid errors in particular conditions.
# For instance: open a scene, modify something and close without saving it.
return self.node.graph and self.isInput and self.node.graph.edges and self in self.node.graph.edges.keys()
@staticmethod
def isLinkExpression(value):