fix bug and possible crash in overloaded method PropertyLinkSubList::setValues
This commit is contained in:
@@ -703,10 +703,10 @@ void PropertyLinkSubList::setValue(DocumentObject* lValue,const char* SubName)
|
||||
}
|
||||
|
||||
void PropertyLinkSubList::setValues(const std::vector<DocumentObject*>& lValue,const std::vector<const char*>& 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<DocumentObject*>& lValue,c
|
||||
_lValueList = lValue;
|
||||
_lSubList.resize(lSubNames.size());
|
||||
int i = 0;
|
||||
for (std::vector<const char*>::const_iterator it = lSubNames.begin();it!=lSubNames.end();++it)
|
||||
_lSubList[i] = *it;
|
||||
for (std::vector<const char*>::const_iterator it = lSubNames.begin();it!=lSubNames.end();++it,++i) {
|
||||
if (*it != nullptr)
|
||||
_lSubList[i] = *it;
|
||||
}
|
||||
hasSetValue();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user