TD: Fix DrawViewCollection::unsetupObject()

Assigning a null pointer to a std::string causes a failure
This commit is contained in:
wmayer
2024-07-02 23:26:47 +02:00
committed by WandererFan
parent 04cc890fd0
commit fdfffbcc9e

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;