From 056025c5c2ddc5bca93d5f104372f8b224fe4891 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 1 Dec 2018 09:50:11 +0900 Subject: [PATCH] Fix handling of API responses --- osu.Game.Tournament/Components/TournamentBeatmapPanel.cs | 3 +++ osu.Game.Tournament/TournamentGameBase.cs | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/osu.Game.Tournament/Components/TournamentBeatmapPanel.cs b/osu.Game.Tournament/Components/TournamentBeatmapPanel.cs index 3165e5a2c4..ae2e2b5160 100644 --- a/osu.Game.Tournament/Components/TournamentBeatmapPanel.cs +++ b/osu.Game.Tournament/Components/TournamentBeatmapPanel.cs @@ -1,6 +1,7 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System; using System.Collections.ObjectModel; using System.Collections.Specialized; using System.Linq; @@ -39,6 +40,8 @@ namespace osu.Game.Tournament.Components public TournamentBeatmapPanel(BeatmapInfo beatmap, string mods = null) { + if (beatmap == null) throw new ArgumentNullException(nameof(beatmap)); + Beatmap = beatmap; this.mods = mods; Width = 400; diff --git a/osu.Game.Tournament/TournamentGameBase.cs b/osu.Game.Tournament/TournamentGameBase.cs index 8734b2e64b..e37b7cf8d6 100644 --- a/osu.Game.Tournament/TournamentGameBase.cs +++ b/osu.Game.Tournament/TournamentGameBase.cs @@ -113,8 +113,8 @@ namespace osu.Game.Tournament if (string.IsNullOrEmpty(p.Username)) { var req = new GetUserRequest(p.Id); - req.Success += i => p.Username = i.Username; req.Perform(API); + p.Username = req.Result.Username; addedInfo = true; } @@ -125,8 +125,8 @@ namespace osu.Game.Tournament if (b.BeatmapInfo == null) { var req = new GetBeatmapRequest(new BeatmapInfo { OnlineBeatmapID = b.ID }); - req.Success += i => b.BeatmapInfo = i.ToBeatmap(RulesetStore); req.Perform(API); + b.BeatmapInfo = req.Result?.ToBeatmap(RulesetStore); addedInfo = true; }