Fixed a segfault which would occur when the size of possibleRuleChanges was less than 3 (maxReplacementCount)
This commit is contained in:
parent
22d8dbee64
commit
6da2ca1b2f
|
@ -141,7 +141,11 @@ ContinuousTimeline<ShapeRule> fixStaticSegmentRules(const ContinuousTimeline<Sha
|
||||||
|
|
||||||
// Find best solution. Start with a single replacement, then increase as necessary.
|
// Find best solution. Start with a single replacement, then increase as necessary.
|
||||||
RuleChangeScenario bestScenario(shapeRules, {}, animate);
|
RuleChangeScenario bestScenario(shapeRules, {}, animate);
|
||||||
for (int replacementCount = 1; bestScenario.getStaticSegmentCount() > 0 && replacementCount <= maxReplacementCount; ++replacementCount) {
|
for (
|
||||||
|
int replacementCount = 1;
|
||||||
|
bestScenario.getStaticSegmentCount() > 0 && replacementCount <= std::min(static_cast<int>(possibleRuleChanges.size()), maxReplacementCount);
|
||||||
|
++replacementCount
|
||||||
|
) {
|
||||||
// Only the first <replacementCount> elements of `currentRuleChanges` count
|
// Only the first <replacementCount> elements of `currentRuleChanges` count
|
||||||
auto currentRuleChanges(possibleRuleChanges);
|
auto currentRuleChanges(possibleRuleChanges);
|
||||||
do {
|
do {
|
||||||
|
|
Loading…
Reference in New Issue