From 6da2ca1b2f616be8502c6aa7c877d667bc55f6dd Mon Sep 17 00:00:00 2001 From: Brian Small Date: Wed, 22 Nov 2017 01:46:09 -0800 Subject: [PATCH] Fixed a segfault which would occur when the size of possibleRuleChanges was less than 3 (maxReplacementCount) --- src/animation/staticSegments.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/animation/staticSegments.cpp b/src/animation/staticSegments.cpp index 33ca391..7c4a7ec 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 {