diff --git a/src/Mod/PartDesign/Gui/TaskDatumParameters.cpp b/src/Mod/PartDesign/Gui/TaskDatumParameters.cpp index 15b581ddc3..aa8c4868cc 100644 --- a/src/Mod/PartDesign/Gui/TaskDatumParameters.cpp +++ b/src/Mod/PartDesign/Gui/TaskDatumParameters.cpp @@ -138,7 +138,7 @@ bool TaskDlgDatumParameters::accept() { //the user has to decide which option we should take if external references are used bool extReference = false; for (App::DocumentObject* obj : pcDatum->Support.getValues()) { - if (!pcActiveBody->hasObject(obj) && !pcActiveBody->getOrigin()->hasObject(obj)) + if (pcActiveBody && !pcActiveBody->hasObject(obj) && !pcActiveBody->getOrigin()->hasObject(obj)) extReference = true; } @@ -157,7 +157,7 @@ bool TaskDlgDatumParameters::accept() { std::vector subs = pcDatum->Support.getSubValues(); int index = 0; for (App::DocumentObject* obj : pcDatum->Support.getValues()) { - if (!pcActiveBody->hasObject(obj) && !pcActiveBody->getOrigin()->hasObject(obj)) { + if (pcActiveBody && !pcActiveBody->hasObject(obj) && !pcActiveBody->getOrigin()->hasObject(obj)) { auto* copy = PartDesignGui::TaskFeaturePick::makeCopy(obj, subs[index], dlg.radioIndependent->isChecked()); if (copy) { copyObjects.push_back(copy);