From b4c2082b9ef79b810692dba5752e72403d99a063 Mon Sep 17 00:00:00 2001 From: Eric Trombly Date: Fri, 10 Jul 2020 07:46:41 -0500 Subject: [PATCH] fix deleted object error --- src/Mod/Path/PathScripts/PathPocketShapeGui.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/Mod/Path/PathScripts/PathPocketShapeGui.py b/src/Mod/Path/PathScripts/PathPocketShapeGui.py index f085d062c1..21fa3a0a13 100644 --- a/src/Mod/Path/PathScripts/PathPocketShapeGui.py +++ b/src/Mod/Path/PathScripts/PathPocketShapeGui.py @@ -178,11 +178,13 @@ class TaskPanelExtensionPage(PathOpGui.TaskPanelPage): # Unfortunately there's no direct way to determine the object's # livelihood without causing an error so we look for the object # in the document and clean up if it still exists. - for o in self.obj.Document.getObjectsByLabel(self.obj.Label): - if o == obj: - self.obj.ViewObject.RootNode.removeChild(self.switch) - return - PathLog.debug("%s already destroyed - no cleanup required" % (obj.Label)) + try: + for o in self.obj.Document.getObjectsByLabel(self.obj.Label): + if o == obj: + self.obj.ViewObject.RootNode.removeChild(self.switch) + return + except ReferenceError: + PathLog.debug("obj already destroyed - no cleanup required") def getForm(self): return FreeCADGui.PySideUic.loadUi(":/panels/PageOpPocketExtEdit.ui")