From 909f38ccb8e94a55457cacb2610c4dc18de32e85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Candice=20Bent=C3=A9jac?= Date: Fri, 3 Feb 2023 17:43:31 +0100 Subject: [PATCH] [core] Check a graph exists before accessing its name If the graph does not exist, return "UNDEFINED" as its name. --- meshroom/core/attribute.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/meshroom/core/attribute.py b/meshroom/core/attribute.py index e0d71cd339..043804fba4 100644 --- a/meshroom/core/attribute.py +++ b/meshroom/core/attribute.py @@ -92,7 +92,8 @@ def getFullNameToNode(self): def getFullNameToGraph(self): """ Name inside the Graph: graphName.nodeName.groupName.name """ - return '{}.{}'.format(self.node.graph.name, self.getFullNameToNode()) + graphName = self.node.graph.name if self.node.graph else "UNDEFINED" + return '{}.{}'.format(graphName, self.getFullNameToNode()) def asLinkExpr(self): """ Return link expression for this Attribute """ @@ -124,7 +125,8 @@ def getFullLabelToNode(self): def getFullLabelToGraph(self): """ Label inside the Graph: graphName nodeLabel groupLabel Label """ - return '{} {}'.format(self.node.graph.name, self.getFullLabelToNode()) + graphName = self.node.graph.name if self.node.graph else "UNDEFINED" + return '{} {}'.format(graphName, self.getFullLabelToNode()) def getEnabled(self): if isinstance(self.desc.enabled, types.FunctionType):