Browse Source

Fix divide-by-zero crash in `getAnimationProgress()` (#7532)

pull/7547/head
Eric Robinson 1 year ago committed by GitHub
parent
commit
1b522fe260
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 4
      Source/engine/animationinfo.cpp

4
Source/engine/animationinfo.cpp

@ -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;

Loading…
Cancel
Save