diff --git a/src/animation/staticSegments.cpp b/src/animation/staticSegments.cpp index 33ca391e..7c4a7ecc 100644 --- a/src/animation/staticSegments.cpp +++ b/src/animation/staticSegments.cpp @@ -141,7 +141,11 @@ ContinuousTimeline fixStaticSegmentRules(const ContinuousTimeline 0 && replacementCount <= maxReplacementCount; ++replacementCount) { + for ( + int replacementCount = 1; + bestScenario.getStaticSegmentCount() > 0 && replacementCount <= std::min(static_cast(possibleRuleChanges.size()), maxReplacementCount); + ++replacementCount + ) { // Only the first elements of `currentRuleChanges` count auto currentRuleChanges(possibleRuleChanges); do {