mirror of
https://github.com/osukey/osukey.git
synced 2025-05-15 02:27:33 +09:00
Merge pull request #16212 from peppy/fix-beatmap-leaderboard-global-reference
Fix potential errors thrown during beatmap leaderboard display due to incorrect beatmap reference
This commit is contained in:
commit
fa5ee5f72c
@ -115,7 +115,9 @@ namespace osu.Game.Screens.Select.Leaderboards
|
|||||||
|
|
||||||
var cancellationToken = loadCancellationSource.Token;
|
var cancellationToken = loadCancellationSource.Token;
|
||||||
|
|
||||||
if (BeatmapInfo == null)
|
var fetchBeatmapInfo = BeatmapInfo;
|
||||||
|
|
||||||
|
if (fetchBeatmapInfo == null)
|
||||||
{
|
{
|
||||||
PlaceholderState = PlaceholderState.NoneSelected;
|
PlaceholderState = PlaceholderState.NoneSelected;
|
||||||
return null;
|
return null;
|
||||||
@ -124,7 +126,7 @@ namespace osu.Game.Screens.Select.Leaderboards
|
|||||||
if (Scope == BeatmapLeaderboardScope.Local)
|
if (Scope == BeatmapLeaderboardScope.Local)
|
||||||
{
|
{
|
||||||
var scores = scoreManager
|
var scores = scoreManager
|
||||||
.QueryScores(s => !s.DeletePending && s.BeatmapInfo.ID == BeatmapInfo.ID && s.Ruleset.ID == ruleset.Value.ID);
|
.QueryScores(s => !s.DeletePending && s.BeatmapInfo.ID == fetchBeatmapInfo.ID && s.Ruleset.ID == ruleset.Value.ID);
|
||||||
|
|
||||||
if (filterMods && !mods.Value.Any())
|
if (filterMods && !mods.Value.Any())
|
||||||
{
|
{
|
||||||
@ -151,7 +153,7 @@ namespace osu.Game.Screens.Select.Leaderboards
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (BeatmapInfo.OnlineID == null || BeatmapInfo?.Status <= BeatmapOnlineStatus.Pending)
|
if (fetchBeatmapInfo.OnlineID == null || fetchBeatmapInfo.Status <= BeatmapOnlineStatus.Pending)
|
||||||
{
|
{
|
||||||
PlaceholderState = PlaceholderState.Unavailable;
|
PlaceholderState = PlaceholderState.Unavailable;
|
||||||
return null;
|
return null;
|
||||||
@ -171,18 +173,18 @@ namespace osu.Game.Screens.Select.Leaderboards
|
|||||||
else if (filterMods)
|
else if (filterMods)
|
||||||
requestMods = mods.Value;
|
requestMods = mods.Value;
|
||||||
|
|
||||||
var req = new GetScoresRequest(BeatmapInfo, ruleset.Value ?? BeatmapInfo.Ruleset, Scope, requestMods);
|
var req = new GetScoresRequest(fetchBeatmapInfo, ruleset.Value ?? fetchBeatmapInfo.Ruleset, Scope, requestMods);
|
||||||
|
|
||||||
req.Success += r =>
|
req.Success += r =>
|
||||||
{
|
{
|
||||||
scoreManager.OrderByTotalScoreAsync(r.Scores.Select(s => s.CreateScoreInfo(rulesets, BeatmapInfo)).ToArray(), cancellationToken)
|
scoreManager.OrderByTotalScoreAsync(r.Scores.Select(s => s.CreateScoreInfo(rulesets, fetchBeatmapInfo)).ToArray(), cancellationToken)
|
||||||
.ContinueWith(ordered => Schedule(() =>
|
.ContinueWith(ordered => Schedule(() =>
|
||||||
{
|
{
|
||||||
if (cancellationToken.IsCancellationRequested)
|
if (cancellationToken.IsCancellationRequested)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
scoresCallback?.Invoke(ordered.Result);
|
scoresCallback?.Invoke(ordered.Result);
|
||||||
TopScore = r.UserScore?.CreateScoreInfo(rulesets, BeatmapInfo);
|
TopScore = r.UserScore?.CreateScoreInfo(rulesets, fetchBeatmapInfo);
|
||||||
}), TaskContinuationOptions.OnlyOnRanToCompletion);
|
}), TaskContinuationOptions.OnlyOnRanToCompletion);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user