From 75d785a5f0a04c738eea76fe7802c35e525a4f29 Mon Sep 17 00:00:00 2001 From: KPhoenix Date: Sun, 18 Dec 2022 20:07:01 -0500 Subject: [PATCH] Bugfix: AnimationInfo integer division by 0 --- Source/engine/animationinfo.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Source/engine/animationinfo.cpp b/Source/engine/animationinfo.cpp index 4cf4955c7..715b2fdcf 100644 --- a/Source/engine/animationinfo.cpp +++ b/Source/engine/animationinfo.cpp @@ -162,7 +162,11 @@ void AnimationInfo::setNewAnimation(OptionalClxSpriteList celSprite, int8_t numb relevantAnimationTicksWithSkipping += previewShownGameTickFragments; // if we skipped Frames we need to expand the game ticks to make one game tick for this Animation "faster" - int32_t tickModifier = baseValueFraction * relevantAnimationTicksForDistribution / relevantAnimationTicksWithSkipping; + int32_t tickModifier; + if (relevantAnimationTicksWithSkipping != 0) + tickModifier = baseValueFraction * relevantAnimationTicksForDistribution / relevantAnimationTicksWithSkipping; + else + tickModifier = 0; // tickModifier specifies the Animation fraction per game tick, so we have to remove the delay from the variable tickModifier /= ticksPerFrame;