mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 10:33:30 +08:00
Address null reference warnings
This commit is contained in:
parent
9ae49f8ee7
commit
2c65fe197a
@ -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);
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user