From a2bfe1bbe140a03e5ae3d9cb0a368cc10a52f54c Mon Sep 17 00:00:00 2001 From: wmayer Date: Wed, 27 Sep 2017 19:12:30 +0200 Subject: [PATCH] check for correct selection in Symmetry and Array sketcher commands --- src/Mod/Sketcher/Gui/CommandSketcherTools.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/Mod/Sketcher/Gui/CommandSketcherTools.cpp b/src/Mod/Sketcher/Gui/CommandSketcherTools.cpp index 0fe1c42c63..3b08693b65 100644 --- a/src/Mod/Sketcher/Gui/CommandSketcherTools.cpp +++ b/src/Mod/Sketcher/Gui/CommandSketcherTools.cpp @@ -832,6 +832,12 @@ void CmdSketcherSymmetry::activated(int iMsg) // get the needed lists and objects const std::vector &SubNames = selection[0].getSubNames(); + if (SubNames.empty()) { + QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Wrong selection"), + QObject::tr("Select elements from a single sketch.")); + return; + } + Sketcher::SketchObject* Obj = static_cast(selection[0].getObject()); getSelection().clearSelection(); @@ -1620,6 +1626,12 @@ void CmdSketcherRectangularArray::activated(int iMsg) // get the needed lists and objects const std::vector &SubNames = selection[0].getSubNames(); + if (SubNames.empty()) { + QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Wrong selection"), + QObject::tr("Select elements from a single sketch.")); + return; + } + Sketcher::SketchObject* Obj = static_cast(selection[0].getObject()); getSelection().clearSelection();