From eb9985500bb1e2d04ca36153921230b4897c0da6 Mon Sep 17 00:00:00 2001 From: wmayer Date: Mon, 19 Oct 2020 14:42:32 +0200 Subject: [PATCH] PartDesign: [skip ci] make the hole feature more forgiving in case of inconsistent configuration --- src/Mod/PartDesign/App/FeatureHole.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/Mod/PartDesign/App/FeatureHole.cpp b/src/Mod/PartDesign/App/FeatureHole.cpp index d71829aa31..441c78481d 100644 --- a/src/Mod/PartDesign/App/FeatureHole.cpp +++ b/src/Mod/PartDesign/App/FeatureHole.cpp @@ -592,8 +592,11 @@ void Hole::updateDiameterParam() void Hole::onChanged(const App::Property *prop) { if (prop == &ThreadType) { - std::string type(ThreadType.getValueAsString()); - std::string holeCutType(HoleCutType.getValueAsString()); + std::string type, holeCutType; + if (ThreadType.isValid()) + type = ThreadType.getValueAsString(); + if (HoleCutType.isValid()) + holeCutType = HoleCutType.getValueAsString(); if (type == "None" ) { ThreadSize.setEnums(ThreadSize_None_Enums); @@ -802,8 +805,11 @@ void Hole::onChanged(const App::Property *prop) updateDiameterParam(); } else if (prop == &HoleCutType) { - std::string threadType = ThreadType.getValueAsString(); - std::string holeCutType = HoleCutType.getValueAsString(); + std::string threadType, holeCutType; + if (ThreadType.isValid()) + threadType = ThreadType.getValueAsString(); + if (HoleCutType.isValid()) + holeCutType = HoleCutType.getValueAsString(); bool holeCutEnable = ( threadType != "ISOMetricProfile" && threadType !="ISOMetricFineProfile" && (holeCutType != "None"));