diff --git a/src/App/Document.cpp b/src/App/Document.cpp index 7276901e45..d5af1f0449 100644 --- a/src/App/Document.cpp +++ b/src/App/Document.cpp @@ -4215,6 +4215,10 @@ void Document::removeObject(const char* sName) } } + // In case the object gets deleted the pointer must be nullified + if (tobedestroyed) { + tobedestroyed->pcNameInDocument = nullptr; + } d->objectMap.erase(pos); }