1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-11 01:07:23 +08:00

Fix drain length calculation helper method being able to return negative durations

This is the principal failure behind
https://github.com/ppy/osu-server-beatmap-submission/issues/40.
This commit is contained in:
Bartłomiej Dach 2025-03-03 09:35:46 +01:00
parent 0a50fb1dfa
commit 87fb8da351
No known key found for this signature in database

View File

@ -161,7 +161,7 @@ namespace osu.Game.Beatmaps
/// <summary>
/// Find the total milliseconds between the first and last hittable objects, excluding any break time.
/// </summary>
public static double CalculateDrainLength(this IBeatmap beatmap) => CalculatePlayableLength(beatmap.HitObjects) - beatmap.TotalBreakTime;
public static double CalculateDrainLength(this IBeatmap beatmap) => Math.Max(CalculatePlayableLength(beatmap.HitObjects) - beatmap.TotalBreakTime, 0);
/// <summary>
/// Find the timestamps in milliseconds of the start and end of the playable region.