Part: compound filter, fix gui object delete if obj has no Base anymore

This commit is contained in:
Bernd Hahnebach
2020-01-07 14:56:52 +01:00
committed by GitHub
parent cec0339cd0
commit 6f52e8425e

View File

@@ -206,11 +206,18 @@ class _ViewProviderCompoundFilter:
def onDelete(self, feature, subelements): # subelements is a tuple of strings
if not self.ViewObject.DontUnhideOnDelete:
try:
self.Object.Base.ViewObject.show()
if self.Object.Base:
# the base object migt be deleted be the user
# https://forum.freecadweb.org/viewtopic.php?f=3&t=42242
self.Object.Base.ViewObject.show()
if self.Object.Stencil:
self.Object.Stencil.ViewObject.show()
except Exception as err:
FreeCAD.Console.PrintError("Error in onDelete: " + err.message)
if hasattr(err, "message"):
error_string = err.message
else:
error_string = err
FreeCAD.Console.PrintError("Error in onDelete: {}\n".format(error_string))
return True