From 534e8f8fac69c2df110922f17b1b6f79ecfde98f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 1 Jun 2022 20:20:16 +0900 Subject: [PATCH] Only switch to found group if non-null --- osu.Game/Screens/Edit/Timing/TimingScreen.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/osu.Game/Screens/Edit/Timing/TimingScreen.cs b/osu.Game/Screens/Edit/Timing/TimingScreen.cs index ebb958f884..d7ca306037 100644 --- a/osu.Game/Screens/Edit/Timing/TimingScreen.cs +++ b/osu.Game/Screens/Edit/Timing/TimingScreen.cs @@ -158,9 +158,12 @@ namespace osu.Game.Screens.Edit.Timing // To improve the efficiency of this in the future, we should reconsider the overall structure of ControlPointInfo. // Find the next group which has the same type as the selected one. - selectedGroup.Value = Beatmap.ControlPointInfo.Groups - .Where(g => g.ControlPoints.Any(cp => cp.GetType() == selectedPointType)) - .LastOrDefault(g => g.Time <= clock.CurrentTimeAccurate); + var found = Beatmap.ControlPointInfo.Groups + .Where(g => g.ControlPoints.Any(cp => cp.GetType() == selectedPointType)) + .LastOrDefault(g => g.Time <= clock.CurrentTimeAccurate); + + if (found != null) + selectedGroup.Value = found; } }