diff --git a/src/Mod/PartDesign/Gui/TaskLoftParameters.cpp b/src/Mod/PartDesign/Gui/TaskLoftParameters.cpp
index bfe2732761..a8d8d7184e 100644
--- a/src/Mod/PartDesign/Gui/TaskLoftParameters.cpp
+++ b/src/Mod/PartDesign/Gui/TaskLoftParameters.cpp
@@ -44,6 +44,7 @@
#include
#include
#include
+#include
#include
#include
#include
@@ -388,19 +389,22 @@ TaskDlgLoftParameters::~TaskDlgLoftParameters()
{
}
-
bool TaskDlgLoftParameters::accept()
{
- // TODO Fill this with commands (2015-09-11, Fat-Zer)
PartDesign::Loft* pcLoft = static_cast(vp->getObject());
static_cast(vp)->highlightReferences(ViewProviderLoft::Both, false);
- for (App::DocumentObject* obj : pcLoft->Sections.getValues()) {
- FCMD_OBJ_HIDE(obj);
+ // First verify that the loft can be built and then hide the sections as otherwise
+ // they will remain hidden if the loft's recompute fails
+ if (TaskDlgSketchBasedParameters::accept()) {
+ for (App::DocumentObject* obj : pcLoft->Sections.getValues()) {
+ Gui::cmdAppObjectHide(obj);
+ }
+
+ return true;
}
-
- return TaskDlgSketchBasedParameters::accept ();
+ return false;
}
//==== calls from the TaskView ===============================================================