1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-21 14:47:25 +08:00

Fix timeline break piece crashing on drag if there are no objects before start or after end

This fixes the direct cause of https://github.com/ppy/osu/issues/28577.
This commit is contained in:
Bartłomiej Dach 2024-06-25 12:25:37 +02:00
parent b4cefe0cc2
commit 03cdfd0660
No known key found for this signature in database

View File

@ -170,8 +170,8 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
changeHandler?.BeginChange();
updateState();
double min = beatmap.HitObjects.Last(ho => ho.GetEndTime() <= Break.Value.StartTime).GetEndTime();
double max = beatmap.HitObjects.First(ho => ho.StartTime >= Break.Value.EndTime).StartTime;
double min = beatmap.HitObjects.LastOrDefault(ho => ho.GetEndTime() <= Break.Value.StartTime)?.GetEndTime() ?? double.NegativeInfinity;
double max = beatmap.HitObjects.FirstOrDefault(ho => ho.StartTime >= Break.Value.EndTime)?.StartTime ?? double.PositiveInfinity;
if (isStartHandle)
max = Math.Min(max, Break.Value.EndTime - BreakPeriod.MIN_BREAK_DURATION);