From 85294070238d44f7e70f3d352ff2b0b79e3c805a Mon Sep 17 00:00:00 2001 From: wmayer Date: Fri, 30 Mar 2018 11:37:42 +0200 Subject: [PATCH] fix bug and possible crash in overloaded method PropertyLinkSubList::setValues --- src/App/PropertyLinks.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/App/PropertyLinks.cpp b/src/App/PropertyLinks.cpp index 772c54986c..a89b5343cb 100644 --- a/src/App/PropertyLinks.cpp +++ b/src/App/PropertyLinks.cpp @@ -703,10 +703,10 @@ void PropertyLinkSubList::setValue(DocumentObject* lValue,const char* SubName) } void PropertyLinkSubList::setValues(const std::vector& lValue,const std::vector& lSubNames) -{ +{ if (lValue.size() != lSubNames.size()) throw Base::ValueError("PropertyLinkSubList::setValues: size of subelements list != size of objects list"); - + #ifndef USE_OLD_DAG //maintain backlinks. if (getContainer() && getContainer()->isDerivedFrom(App::DocumentObject::getClassTypeId())) { @@ -731,8 +731,10 @@ void PropertyLinkSubList::setValues(const std::vector& lValue,c _lValueList = lValue; _lSubList.resize(lSubNames.size()); int i = 0; - for (std::vector::const_iterator it = lSubNames.begin();it!=lSubNames.end();++it) - _lSubList[i] = *it; + for (std::vector::const_iterator it = lSubNames.begin();it!=lSubNames.end();++it,++i) { + if (*it != nullptr) + _lSubList[i] = *it; + } hasSetValue(); }