mirror of
https://github.com/ppy/osu.git
synced 2025-02-20 04:23:14 +08:00
Fix handling of API responses
This commit is contained in:
parent
0bc4a01a6b
commit
056025c5c2
@ -1,6 +1,7 @@
|
||||
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// 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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user