diff --git a/src/App/OriginGroupExtension.cpp b/src/App/OriginGroupExtension.cpp index 4cf4d36533..0d4ddbd081 100644 --- a/src/App/OriginGroupExtension.cpp +++ b/src/App/OriginGroupExtension.cpp @@ -167,20 +167,17 @@ void OriginGroupExtension::relinkToOrigin(App::DocumentObject* obj) p->setValue(getOrigin()->getOriginFeature(static_cast(p->getValue())->Role.getValue()), subValues); } else if(prop->getTypeId().isDerivedFrom(App::PropertyLinkSubList::getClassTypeId())) { - auto p = static_cast(prop); - auto vec = p->getValues(); - std::vector result; + auto p = static_cast(prop); + auto vec = p->getSubListValues(); bool changed = false; - for(App::DocumentObject* o : vec) { - if(!o || !o->isDerivedFrom(App::OriginFeature::getClassTypeId())) - result.push_back(o); - else { - result.push_back(getOrigin()->getOriginFeature(static_cast(o)->Role.getValue())); + for(auto &v : vec) { + if(v.first && v.first->isDerivedFrom(App::OriginFeature::getClassTypeId())) { + v.first = getOrigin()->getOriginFeature(static_cast(v.first)->Role.getValue()); changed = true; } } if(changed) - static_cast(prop)->setValues(result); + p->setSubListValues(vec); } } }