1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-26 12:25:04 +08:00

Merge pull request #20177 from peppy/fix-target-mod-crash

Fix target mod crashing if beatmap is played with a break after all hitobjects
This commit is contained in:
Dan Balasescu 2022-09-07 19:24:19 +09:00 committed by GitHub
commit 85ce1bcea9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -362,10 +362,12 @@ namespace osu.Game.Rulesets.Osu.Mods
{
return breaks.Any(breakPeriod =>
{
var firstObjAfterBreak = originalHitObjects.First(obj => almostBigger(obj.StartTime, breakPeriod.EndTime));
OsuHitObject? firstObjAfterBreak = originalHitObjects.FirstOrDefault(obj => almostBigger(obj.StartTime, breakPeriod.EndTime));
return almostBigger(time, breakPeriod.StartTime)
&& definitelyBigger(firstObjAfterBreak.StartTime, time);
// There should never really be a break section with no objects after it, but we've seen crashes from users with malformed beatmaps,
// so it's best to guard against this.
&& (firstObjAfterBreak == null || definitelyBigger(firstObjAfterBreak.StartTime, time));
});
}