mirror of
https://github.com/ppy/osu
synced 2025-02-01 19:02:00 +00:00
Ensure an OnlineBeatmapID is present before attempting API requests
This commit is contained in:
parent
a0bbabd18f
commit
b72921b30e
@ -5,7 +5,6 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Newtonsoft.Json;
|
||||
using osu.Framework.IO.Network;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Users;
|
||||
using osu.Game.Rulesets.Replays;
|
||||
@ -19,6 +18,9 @@ namespace osu.Game.Online.API.Requests
|
||||
|
||||
public GetScoresRequest(BeatmapInfo beatmap)
|
||||
{
|
||||
if (!beatmap.OnlineBeatmapID.HasValue)
|
||||
throw new InvalidOperationException($"Cannot lookup a beatmap's scores without having a populated {nameof(BeatmapInfo.OnlineBeatmapID)}.");
|
||||
|
||||
this.beatmap = beatmap;
|
||||
|
||||
Success += onSuccess;
|
||||
@ -30,14 +32,6 @@ namespace osu.Game.Online.API.Requests
|
||||
score.ApplyBeatmap(beatmap);
|
||||
}
|
||||
|
||||
protected override WebRequest CreateWebRequest()
|
||||
{
|
||||
var req = base.CreateWebRequest();
|
||||
//req.AddParameter(@"c", beatmap.Hash);
|
||||
//req.AddParameter(@"f", beatmap.Path);
|
||||
return req;
|
||||
}
|
||||
|
||||
protected override string Target => $@"beatmaps/{beatmap.OnlineBeatmapID}/scores";
|
||||
}
|
||||
|
||||
|
@ -130,7 +130,7 @@ namespace osu.Game.Screens.Select.Leaderboards
|
||||
Scores = null;
|
||||
getScoresRequest?.Cancel();
|
||||
|
||||
if (api == null || Beatmap == null) return;
|
||||
if (api == null || Beatmap?.OnlineBeatmapID == null) return;
|
||||
|
||||
loading.Show();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user