1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-15 15:23:14 +08:00

Don't fail if the local user is not present in room users when updating ready button state

This commit is contained in:
Dean Herbert 2020-12-26 10:49:22 +09:00
parent f9900720d5
commit fe1bbb1cac

View File

@ -60,7 +60,9 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Match
{
base.OnRoomUpdated();
localUser = Room?.Users.Single(u => u.User?.Id == api.LocalUser.Value.Id);
// this method is called on leaving the room, so the local user may not exist in the room any more.
localUser = Room?.Users.SingleOrDefault(u => u.User?.Id == api.LocalUser.Value.Id);
button.Enabled.Value = Client.Room?.State == MultiplayerRoomState.Open;
updateState();
}