diff --git a/src/Mod/PartDesign/Gui/Command.cpp b/src/Mod/PartDesign/Gui/Command.cpp index e52bf372f5..2c13898ecb 100644 --- a/src/Mod/PartDesign/Gui/Command.cpp +++ b/src/Mod/PartDesign/Gui/Command.cpp @@ -556,6 +556,10 @@ void CmdPartDesignNewSketch::activated(int iMsg) // Called by dialog when user hits "OK" and accepter returns true auto worker = [=](const std::vector& features) { + // may happen when the user switched to an empty document while the + // dialog is open + if (features.empty()) + return; App::Plane* plane = static_cast(features.front()); std::string FeatName = getUniqueObjectName("Sketch"); std::string supportString = std::string("(App.activeDocument().") + plane->getNameInDocument() +