Add precautionary guard to avoid potential div-by-zero

Probably wouldn't happen outside of tests, but I'd rather not find out
next release.
This commit is contained in:
Bartłomiej Dach 2024-03-26 17:36:00 +01:00
parent e02ad6cf94
commit 0b29a762b8
No known key found for this signature in database

View File

@ -97,7 +97,8 @@ namespace osu.Game.Graphics.Containers
// This means that the amount of early adjustment is adjusted in line with audio track rate changes.
// But other cases like the osu! logo at the main menu won't correctly have this rate information.
// We can adjust here to ensure the applied early activation always matches expectations.
early *= BeatSyncSource.Clock.Rate / Clock.Rate;
if (Clock.Rate > 0)
early *= BeatSyncSource.Clock.Rate / Clock.Rate;
currentTrackTime = BeatSyncSource.Clock.CurrentTime + early;