1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-28 06:42:54 +08:00

Ensure clients don't blow up when given user isn't in room

This commit is contained in:
Salman Ahmed 2021-01-03 18:36:37 +03:00
parent c8423d1c46
commit 839f5a7570

View File

@ -320,10 +320,13 @@ namespace osu.Game.Online.Multiplayer
Scheduler.Add(() => Scheduler.Add(() =>
{ {
if (Room == null) var user = Room?.Users.SingleOrDefault(u => u.UserID == userId);
// we don't care whether the room doesn't exist or user isn't in joined room, just return in that point.
if (user == null)
return; return;
Room.Users.Single(u => u.UserID == userId).BeatmapAvailability = beatmapAvailability; user.BeatmapAvailability = beatmapAvailability;
RoomUpdated?.Invoke(); RoomUpdated?.Invoke();
}, false); }, false);