TD: Fix DrawViewCollection::unsetupObject()

Assigning a null pointer to a std::string causes a failure
This commit is contained in:
wmayer
2024-07-03 09:07:17 -04:00
committed by WandererFan
parent 04cc890fd0
commit fdfffbcc9e
+5 -3
View File
@@ -213,9 +213,11 @@ void DrawViewCollection::unsetupObject()
std::string docName = getDocument()->getName();
for (auto* view : Views.getValues()) {
std::string viewName = view->getNameInDocument();
Base::Interpreter().runStringArg("App.getDocument(\"%s\").removeObject(\"%s\")",
docName.c_str(), viewName.c_str());
if (view->isAttachedToDocument()) {
std::string viewName = view->getNameInDocument();
Base::Interpreter().runStringArg("App.getDocument(\"%s\").removeObject(\"%s\")",
docName.c_str(), viewName.c_str());
}
}
std::vector<App::DocumentObject*> emptyViews;