1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-06 06:57:39 +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(() =>
{
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;
Room.Users.Single(u => u.UserID == userId).BeatmapAvailability = beatmapAvailability;
user.BeatmapAvailability = beatmapAvailability;
RoomUpdated?.Invoke();
}, false);