Document::breakDependency should handle exceptions to avoid to leave document in an inconsistent state

This commit is contained in:
wmayer
2019-03-15 14:41:43 +01:00
parent 45a04278f6
commit ca7770b80a

View File

@@ -3031,7 +3031,13 @@ void Document::breakDependency(DocumentObject* pcObject, bool clear)
std::vector<App::ObjectIdentifier> paths;
pcObject->ExpressionEngine.getPathsToDocumentObject(it->second, paths);
for (std::vector<App::ObjectIdentifier>::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();
}
}
}
}