Fix hard crashes on tournament client if a round contains an empty beatmap

This commit is contained in:
Dean Herbert 2020-01-19 22:26:15 +09:00
parent 3f2512295c
commit 55ed823c88

View File

@ -223,9 +223,11 @@ namespace osu.Game.Tournament
foreach (var r in ladder.Rounds) 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)
{
if (b.ID > 0)
{ {
var req = new GetBeatmapRequest(new BeatmapInfo { OnlineBeatmapID = b.ID }); var req = new GetBeatmapRequest(new BeatmapInfo { OnlineBeatmapID = b.ID });
API.Perform(req); API.Perform(req);
@ -233,6 +235,11 @@ namespace osu.Game.Tournament
addedInfo = true; 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);
}
} }
} }