Fix incorrect bank set / sample addition logic

Closes https://github.com/ppy/osu/issues/29361.

Typical case of a few early-returns gone wrong leading to `NodeSamples`
not being checked correctly.
This commit is contained in:
Bartłomiej Dach 2024-08-20 12:36:13 +02:00
parent 3202c77279
commit c9f1ef5361
No known key found for this signature in database

View File

@ -229,7 +229,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
EditorBeatmap.PerformOnSelection(h =>
{
if (h.Samples.All(s => s.Bank == bankName))
if (hasRelevantBank(h))
return;
h.Samples = h.Samples.Select(s => s.With(newBank: bankName)).ToList();
@ -269,10 +269,8 @@ namespace osu.Game.Screens.Edit.Compose.Components
EditorBeatmap.PerformOnSelection(h =>
{
// Make sure there isn't already an existing sample
if (h.Samples.Any(s => s.Name == sampleName))
return;
h.Samples.Add(h.CreateHitSampleInfo(sampleName));
if (h.Samples.All(s => s.Name != sampleName))
h.Samples.Add(h.CreateHitSampleInfo(sampleName));
if (h is IHasRepeats hasRepeats)
{