Sketcher: Ensure loop can exit
Coverity issue 513796
This commit is contained in:
committed by
Benjamin Nauck
parent
5502fafafb
commit
e12deea20e
@@ -1044,6 +1044,14 @@ void CmdSketcherMergeSketches::activated(int iMsg)
|
||||
|
||||
int addedConstraints = mergesketch->addCopyOfConstraints(*Obj);
|
||||
|
||||
// Coverity issue 513796: make sure the loop below can complete
|
||||
if (addedConstraints < 0) {
|
||||
continue; // There were no constraints
|
||||
}
|
||||
if (addedConstraints - baseConstraints < 0) {
|
||||
throw Base::ValueError("Constraint error in CmdSketcherMergeSketches");
|
||||
}
|
||||
|
||||
for (int i = 0; i <= (addedConstraints - baseConstraints); i++) {
|
||||
Sketcher::Constraint* constraint =
|
||||
mergesketch->Constraints.getValues()[i + baseConstraints];
|
||||
|
||||
Reference in New Issue
Block a user