diff --git a/src/Mod/Assembly/Gui/ViewProviderAssembly.cpp b/src/Mod/Assembly/Gui/ViewProviderAssembly.cpp index c87cf5622f..839eb832ee 100644 --- a/src/Mod/Assembly/Gui/ViewProviderAssembly.cpp +++ b/src/Mod/Assembly/Gui/ViewProviderAssembly.cpp @@ -861,24 +861,27 @@ ViewProviderAssembly::DragMode ViewProviderAssembly::findDragMode() { auto addPartsToMove = [&](const std::vector& refs) { for (auto& partRef : refs) { - if (!partRef.obj) { + auto obj = partRef.obj; + auto ref = partRef.ref; + if (!obj || !ref) { continue; } - auto* pPlc = dynamic_cast( - partRef.obj->getPropertyByName("Placement") - ); - if (pPlc) { - App::DocumentObject* selRoot = partRef.ref->getValue(); - if (!selRoot) { - continue; - } - std::vector subs = partRef.ref->getSubValues(); - if (subs.empty()) { - continue; - } - docsToMove.emplace_back(partRef.obj, pPlc->getValue(), selRoot, subs[0]); + auto pPlc = dynamic_cast(obj->getPropertyByName("Placement")); + if (!pPlc) { + continue; } + + App::DocumentObject* selRoot = ref->getValue(); + if (!selRoot) { + continue; + } + std::vector subs = ref->getSubValues(); + if (subs.empty()) { + continue; + } + + docsToMove.emplace_back(obj, pPlc->getValue(), selRoot, subs[0]); } };