From ca7770b80a73ec1e8aed2e7f5a7525bd87137a2d Mon Sep 17 00:00:00 2001 From: wmayer Date: Fri, 15 Mar 2019 14:41:43 +0100 Subject: [PATCH] Document::breakDependency should handle exceptions to avoid to leave document in an inconsistent state --- src/App/Document.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/App/Document.cpp b/src/App/Document.cpp index 04034ad98b..c4c31562ef 100644 --- a/src/App/Document.cpp +++ b/src/App/Document.cpp @@ -3031,7 +3031,13 @@ void Document::breakDependency(DocumentObject* pcObject, bool clear) std::vector paths; pcObject->ExpressionEngine.getPathsToDocumentObject(it->second, paths); for (std::vector::iterator jt = paths.begin(); jt != paths.end(); ++jt) { - pcObject->ExpressionEngine.setValue(*jt, nullptr); + // When nullifying the expression handle case where an identifier lacks of the property + try { + pcObject->ExpressionEngine.setValue(*jt, nullptr); + } + catch (const Base::Exception& e) { + e.ReportException(); + } } } }