[PartDesign] [skip ci] #fixes 4367: Thread size out of range using hole-feature

This commit is contained in:
wmayer
2020-08-24 17:36:48 +02:00
parent c714dd0a78
commit 30bc9fc6be

View File

@@ -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;