Use SingleOrDefault() where possible

This commit is contained in:
smoogipoo 2019-12-16 17:03:58 +09:00
parent d56e99865c
commit 98dd1c2590
1 changed files with 2 additions and 2 deletions

View File

@ -322,13 +322,13 @@ private void handleOsuHitObject(TextWriter writer, HitObject hitObject)
private string getSampleBank(IList<HitSampleInfo> samples, bool banksOnly = false, bool zeroBanks = false)
{
LegacySampleBank normalBank = toLegacySampleBank(samples.FirstOrDefault(s => s.Name == HitSampleInfo.HIT_NORMAL)?.Bank);
LegacySampleBank normalBank = toLegacySampleBank(samples.SingleOrDefault(s => s.Name == HitSampleInfo.HIT_NORMAL)?.Bank);
LegacySampleBank addBank = toLegacySampleBank(samples.FirstOrDefault(s => !string.IsNullOrEmpty(s.Name) && s.Name != HitSampleInfo.HIT_NORMAL)?.Bank);
string customSampleBank = toLegacyCustomSampleBank(samples.FirstOrDefault()?.Suffix);
string sampleFilename = samples.FirstOrDefault(s => string.IsNullOrEmpty(s.Name))?.LookupNames.First() ?? string.Empty;
int volume = samples.First().Volume;
int volume = samples.FirstOrDefault()?.Volume ?? 100;
StringBuilder sb = new StringBuilder();