From 30bc9fc6be5dd97bb1456d1c0c25c17fb3ffc551 Mon Sep 17 00:00:00 2001 From: wmayer Date: Mon, 24 Aug 2020 17:36:48 +0200 Subject: [PATCH] [PartDesign] [skip ci] #fixes 4367: Thread size out of range using hole-feature --- src/Mod/PartDesign/App/FeatureHole.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/Mod/PartDesign/App/FeatureHole.cpp b/src/Mod/PartDesign/App/FeatureHole.cpp index a4cc276655..d71829aa31 100644 --- a/src/Mod/PartDesign/App/FeatureHole.cpp +++ b/src/Mod/PartDesign/App/FeatureHole.cpp @@ -536,10 +536,20 @@ void Hole::updateDiameterParam() int threadType = ThreadType.getValue(); int threadSize = ThreadSize.getValue(); - if (threadType < 0) + if (threadType < 0) { + // When restoring the feature it might be in an inconsistent state. + // So, just silently ignore it instead of throwing an exception. + if (isRestoring()) + return; throw Base::IndexError("Thread type out of range"); - if (threadSize < 0) + } + if (threadSize < 0) { + // When restoring the feature it might be in an inconsistent state. + // So, just silently ignore it instead of throwing an exception. + if (isRestoring()) + return; throw Base::IndexError("Thread size out of range"); + } double diameter = threadDescription[threadType][threadSize].diameter; double pitch = threadDescription[threadType][threadSize].pitch;