1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-26 18:52:55 +08:00

fix invalidoperation exception

This commit is contained in:
OliBomby 2023-04-26 14:28:48 +02:00
parent c6fc180659
commit 5accb05f45

View File

@ -271,7 +271,9 @@ namespace osu.Game.Beatmaps.Formats
if (hitObject.Samples.Count > 0)
{
int volume = hitObject.Samples.Max(o => o.Volume);
int customIndex = hitObject.Samples.OfType<ConvertHitObjectParser.LegacyHitSampleInfo>().Max(o => o.CustomSampleBank);
int customIndex = hitObject.Samples.Any(o => o is ConvertHitObjectParser.LegacyHitSampleInfo)
? hitObject.Samples.OfType<ConvertHitObjectParser.LegacyHitSampleInfo>().Max(o => o.CustomSampleBank)
: 0;
yield return new LegacyBeatmapDecoder.LegacySampleControlPoint { Time = hitObject.GetEndTime(), SampleVolume = volume, CustomSampleBank = customIndex };
}