From 1d336fe72ec0838001e7a1d2322170bd2f20a300 Mon Sep 17 00:00:00 2001 From: wmayer Date: Fri, 7 Apr 2017 15:32:22 +0200 Subject: [PATCH] avoid possibly crash when trying to add objects to the wrong document --- src/Mod/PartDesign/Gui/Command.cpp | 4 ++++ 1 file changed, 4 insertions(+) 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() +