diff --git a/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/CaretPosition/Algorithms/TimeTagCaretPositionAlgorithm.cs b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/CaretPosition/Algorithms/TimeTagCaretPositionAlgorithm.cs index 272db68cc..fe81965b4 100644 --- a/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/CaretPosition/Algorithms/TimeTagCaretPositionAlgorithm.cs +++ b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/CaretPosition/Algorithms/TimeTagCaretPositionAlgorithm.cs @@ -81,11 +81,8 @@ protected override bool PositionMovable(TimeTagCaretPosition position) protected override TimeTagCaretPosition? MoveToFirstLyric() { var firstLyric = Lyrics.FirstOrDefault(x => x.TimeTags.Any(timeTagMovable)); - if (firstLyric == null) - return null; - - var firstTimeTag = firstLyric.TimeTags.FirstOrDefault(timeTagMovable); - if (firstTimeTag == null) + var firstTimeTag = firstLyric?.TimeTags.FirstOrDefault(timeTagMovable); + if (firstLyric == null || firstTimeTag == null) return null; return CreateCaretPosition(firstLyric, firstTimeTag); @@ -94,11 +91,8 @@ protected override bool PositionMovable(TimeTagCaretPosition position) protected override TimeTagCaretPosition? MoveToLastLyric() { var lastLyric = Lyrics.LastOrDefault(x => x.TimeTags.Any(timeTagMovable)); - if (lastLyric == null) - return null; - - var lastTimeTag = lastLyric.TimeTags.LastOrDefault(timeTagMovable); - if (lastTimeTag == null) + var lastTimeTag = lastLyric?.TimeTags.LastOrDefault(timeTagMovable); + if (lastLyric == null || lastTimeTag == null) return null; return CreateCaretPosition(lastLyric, lastTimeTag);