1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 10:12:54 +08:00

Merge pull request #7561 from peppy/fix-tournament-null-handling

Fix hard crashes on tournament client if a round contains an empty beatmap
This commit is contained in:
Dean Herbert 2020-01-20 12:20:50 +09:00 committed by GitHub
commit fa1b1479ed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -223,9 +223,12 @@ namespace osu.Game.Tournament
foreach (var r in ladder.Rounds)
{
foreach (var b in r.Beatmaps)
foreach (var b in r.Beatmaps.ToList())
{
if (b.BeatmapInfo == null && b.ID > 0)
if (b.BeatmapInfo != null)
continue;
if (b.ID > 0)
{
var req = new GetBeatmapRequest(new BeatmapInfo { OnlineBeatmapID = b.ID });
API.Perform(req);
@ -233,6 +236,10 @@ namespace osu.Game.Tournament
addedInfo = true;
}
if (b.BeatmapInfo == null)
// if online population couldn't be performed, ensure we don't leave a null value behind
r.Beatmaps.Remove(b);
}
}