App: handle exception on change Link CopyOnChange

This commit is contained in:
Zheng, Lei
2022-05-05 21:46:36 +08:00
committed by Chris Hennes
parent cd269d84da
commit 22d6e5a030

View File

@@ -21,6 +21,7 @@
****************************************************************************/
#include "PreCompiled.h"
#include <boost/property_map/property_map.hpp>
#include <boost/range.hpp>
#include <boost/algorithm/string/predicate.hpp>
@@ -460,11 +461,17 @@ void LinkBaseExtension::setOnChangeCopyObject(
if (external == exclude && !prop)
return;
prop = static_cast<PropertyMap*>(
obj->addDynamicProperty("App::PropertyMap", "_CopyOnChangeControl"));
if (!prop) {
FC_ERR("Failed to setup copy on change object " << obj->getFullName());
return;
try {
prop = static_cast<PropertyMap*>(
obj->addDynamicProperty("App::PropertyMap", "_CopyOnChangeControl"));
} catch (Base::Exception &e) {
e.ReportException();
}
if (!prop) {
FC_ERR("Failed to setup copy on change object " << obj->getFullName());
return;
}
}
const char *key = flags.testFlag(OnChangeCopyOptions::ApplyAll) ? "*" : parent->getNameInDocument();