Skip to content

Commit 1b522fe

Browse files
authored
Fix divide-by-zero crash in getAnimationProgress() (#7532)
1 parent 8b74bd5 commit 1b522fe

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Source/engine/animationinfo.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,10 @@ uint8_t AnimationInfo::getAnimationProgress() const
6565
int32_t tickModifier = tickModifier_;
6666

6767
if (relevantFramesForDistributing_ <= 0) {
68+
if (ticksPerFrame <= 0) {
69+
Log("getAnimationProgress: Invalid ticksPerFrame {}", ticksPerFrame);
70+
return 0;
71+
}
6872
// This logic is used if animation distribution is not active (see getFrameToUseForRendering).
6973
// In this case the variables calculated with animation distribution are not initialized and we have to calculate them on the fly with the given information.
7074
ticksSinceSequenceStarted = ((currentFrame * ticksPerFrame) + tickCounterOfCurrentFrame) * baseValueFraction;

0 commit comments

Comments
 (0)