From 624dc3dc36b22a7e7348b11ed0a0b8aacd4f15c4 Mon Sep 17 00:00:00 2001 From: Derrick Timmermans Date: Sat, 2 Mar 2024 15:12:40 +0100 Subject: [PATCH] Avoid div-by-zero in LiveCounter --- osu.Game.Rulesets.Sentakki/UI/Components/LiveCounter.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Sentakki/UI/Components/LiveCounter.cs b/osu.Game.Rulesets.Sentakki/UI/Components/LiveCounter.cs index c846afbb7..823fe3283 100644 --- a/osu.Game.Rulesets.Sentakki/UI/Components/LiveCounter.cs +++ b/osu.Game.Rulesets.Sentakki/UI/Components/LiveCounter.cs @@ -75,7 +75,12 @@ protected override void OnNewBeat(int beatIndex, TimingControlPoint timingPoint, float panicDurationMultiplier = 1 * MathF.Pow(0.75f, panicLevel); float beatMagnitude = 0.1f + (0.05f * panicLevel); - if (beatIndex % (int)(timingPoint.TimeSignature.Numerator * Math.Max(panicDurationMultiplier, 0.5f)) == 0) + int heartbeatFreq = (int)(timingPoint.TimeSignature.Numerator * Math.Max(panicDurationMultiplier, 0.5f)); + + if (heartbeatFreq == 0) + return; + + if (beatIndex % heartbeatFreq == 0) { this.ScaleTo(1 + beatMagnitude, 200 * panicDurationMultiplier) .Then().ScaleTo(1, 120 * panicDurationMultiplier)