diff --git a/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs b/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs index 7bcb08fd43..573706464f 100644 --- a/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs +++ b/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs @@ -620,6 +620,9 @@ namespace osu.Game.Beatmaps.Formats private void handleCustomSoundBanks(string line) { + // If the ruleset wasn't specified, assume the osu!standard ruleset. + parser ??= new Rulesets.Objects.Legacy.Osu.ConvertHitObjectParser(getOffsetTime(), FormatVersion); + if (!parser.AvailableSampleBanks.Contains(line)) { parser.AvailableSampleBanks.Add(line); diff --git a/osu.Game/Beatmaps/Formats/LegacyBeatmapEncoder.cs b/osu.Game/Beatmaps/Formats/LegacyBeatmapEncoder.cs index cfb52ce9e1..504d346f24 100644 --- a/osu.Game/Beatmaps/Formats/LegacyBeatmapEncoder.cs +++ b/osu.Game/Beatmaps/Formats/LegacyBeatmapEncoder.cs @@ -386,8 +386,9 @@ namespace osu.Game.Beatmaps.Formats private void checkCustomSoundBank(HitObject h) { - string bank = h.Samples.SingleOrDefault(s => s.Name == HitSampleInfo.HIT_NORMAL)?.Bank; - if (!customSoundBanks.Contains(bank) + string? bank = h.Samples.SingleOrDefault(s => s.Name == HitSampleInfo.HIT_NORMAL)?.Bank; + if (bank != null + && !customSoundBanks.Contains(bank) && bank != "none" && bank != "normal" && bank != "soft" && bank != "drum") { customSoundBanks.Add(bank); @@ -653,7 +654,8 @@ namespace osu.Game.Beatmaps.Formats return (int)LegacySampleBank.Drum; default: - return customSoundBanks.IndexOf(sampleBankLower) + 4; + if (sampleBankLower != null) return customSoundBanks.IndexOf(sampleBankLower) + 4; + return 0; } }