1
0
mirror of https://github.com/ppy/osu.git synced 2026-06-01 00:30:21 +08:00

Add safeties to avoid MultiplayerPlayer crashing when beatmap can't be loaded

This commit is contained in:
Dean Herbert
2021-08-05 19:01:07 +09:00
Unverified
parent aa4c6b9341
commit fcec714b4f
2 changed files with 14 additions and 1 deletions
@@ -57,6 +57,9 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer
[BackgroundDependencyLoader]
private void load()
{
if (!LoadedBeatmapSuccessfully)
return;
// todo: this should be implemented via a custom HUD implementation, and correctly masked to the main content area.
LoadComponentAsync(leaderboard = new MultiplayerGameplayLeaderboard(ScoreProcessor, userIds), HUDOverlay.Add);
@@ -67,6 +70,9 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer
{
base.LoadAsyncComplete();
if (!LoadedBeatmapSuccessfully)
return;
if (!ValidForResume)
return; // token retrieval may have failed.
@@ -96,6 +102,9 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer
{
base.LoadComplete();
if (!LoadedBeatmapSuccessfully)
return;
((IBindable<bool>)leaderboard.Expanded).BindTo(HUDOverlay.ShowHud);
}
@@ -118,6 +127,10 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer
protected override void Update()
{
base.Update();
if (!LoadedBeatmapSuccessfully)
return;
adjustLeaderboardPosition();
}
+1 -1
View File
@@ -962,7 +962,7 @@ namespace osu.Game.Screens.Play
screenSuspension?.Expire();
// if arriving here and the results screen preparation task hasn't run, it's safe to say the user has not completed the beatmap.
if (prepareScoreForDisplayTask == null)
if (Score != null && prepareScoreForDisplayTask == null)
{
Score.ScoreInfo.Passed = false;
// potentially should be ScoreRank.F instead? this is the best alternative for now.