1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 10:12:54 +08:00

Fix crash when gameplay starts while in multi-spectator screen

This commit is contained in:
Dan Balasescu 2022-02-03 23:22:08 +09:00
parent d4ebff6ea1
commit b41655d5b9
2 changed files with 8 additions and 0 deletions

View File

@ -914,6 +914,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
AddUntilStep("wait for loading", () => client.Room?.State == MultiplayerRoomState.WaitingForLoad);
AddStep("set player loaded", () => client.ChangeUserState(1234, MultiplayerUserState.Loaded));
AddUntilStep("wait for gameplay to start", () => client.Room?.State == MultiplayerRoomState.Playing);
AddUntilStep("wait for local user to enter spectator", () => multiplayerComponents.CurrentScreen is MultiSpectatorScreen);
}
}

View File

@ -457,6 +457,13 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer
return;
}
// The beatmap is queried asynchronously when the selected item changes.
// This is an issue with MultiSpectatorScreen which is effectively in an always "ready" state and receives LoadRequested() callbacks
// even when it is not truly ready (i.e. the beatmap hasn't been selected by the client yet). For the time being, a simple fix to this is to ignore the callback.
// Note that spectator will be entered automatically when the client is capable of doing so via beatmap availability callbacks (see: updateBeatmapAvailability()).
if (client.LocalUser?.State == MultiplayerUserState.Spectating && Beatmap.IsDefault)
return;
StartPlay();
readyClickOperation?.Dispose();