1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 02:42:54 +08:00

Check for zero rate to prevent crashes on unpause

This commit is contained in:
Bartłomiej Dach 2020-08-11 22:34:46 +02:00
parent bcaaf25278
commit 4f3f95540b

View File

@ -42,6 +42,10 @@ namespace osu.Game.Rulesets.Osu.Mods
spinner.RotationTracker.Tracking = true; spinner.RotationTracker.Tracking = true;
// early-return if we were paused to avoid division-by-zero in the subsequent calculations.
if (Precision.AlmostEquals(spinner.Clock.Rate, 0))
return;
// because the spinner is under the gameplay clock, it is affected by rate adjustments on the track; // because the spinner is under the gameplay clock, it is affected by rate adjustments on the track;
// for that reason using ElapsedFrameTime directly leads to fewer SPM with Half Time and more SPM with Double Time. // for that reason using ElapsedFrameTime directly leads to fewer SPM with Half Time and more SPM with Double Time.
// for spinners we want the real (wall clock) elapsed time; to achieve that, unapply the clock rate locally here. // for spinners we want the real (wall clock) elapsed time; to achieve that, unapply the clock rate locally here.