From 572f693eec361a69d83dedc317fa9608bd816099 Mon Sep 17 00:00:00 2001 From: Andrei Zavatski Date: Sat, 17 Feb 2024 23:28:35 +0300 Subject: [PATCH] Fix failing tests related to slider ticks --- osu.Game.Rulesets.Osu/Objects/Slider.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Objects/Slider.cs b/osu.Game.Rulesets.Osu/Objects/Slider.cs index 79bf91bcae..203e829180 100644 --- a/osu.Game.Rulesets.Osu/Objects/Slider.cs +++ b/osu.Game.Rulesets.Osu/Objects/Slider.cs @@ -253,7 +253,7 @@ private void updateNestedPositions() protected void UpdateNestedSamples() { // TODO: remove this when guaranteed sort is present for samples (https://github.com/ppy/osu/issues/1933) - HitSampleInfo tickSample = (Samples.FirstOrDefault(s => s.Name == HitSampleInfo.HIT_NORMAL) ?? Samples.First()).With("slidertick"); + HitSampleInfo tickSample = (Samples.FirstOrDefault(s => s.Name == HitSampleInfo.HIT_NORMAL) ?? Samples.FirstOrDefault())?.With("slidertick"); foreach (var nested in NestedHitObjects) { @@ -261,7 +261,9 @@ protected void UpdateNestedSamples() { case SliderTick tick: tick.SamplesBindable.Clear(); - tick.SamplesBindable.Add(tickSample); + + if (tickSample != null) + tick.SamplesBindable.Add(tickSample); break; case SliderRepeat repeat: