Skip to content

Commit

Permalink
Fix divide-by-zero crash in getAnimationProgress() (#7532)
Browse files Browse the repository at this point in the history
  • Loading branch information
kphoenix137 authored Nov 16, 2024
1 parent 8b74bd5 commit 1b522fe
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Source/engine/animationinfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ uint8_t AnimationInfo::getAnimationProgress() const
int32_t tickModifier = tickModifier_;

if (relevantFramesForDistributing_ <= 0) {
if (ticksPerFrame <= 0) {
Log("getAnimationProgress: Invalid ticksPerFrame {}", ticksPerFrame);
return 0;
}
// This logic is used if animation distribution is not active (see getFrameToUseForRendering).
// 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.
ticksSinceSequenceStarted = ((currentFrame * ticksPerFrame) + tickCounterOfCurrentFrame) * baseValueFraction;
Expand Down

0 comments on commit 1b522fe

Please sign in to comment.