diff --git a/ViewModels/MainWindowViewModel.cs b/ViewModels/MainWindowViewModel.cs index 96db667..f5d4915 100644 --- a/ViewModels/MainWindowViewModel.cs +++ b/ViewModels/MainWindowViewModel.cs @@ -148,6 +148,7 @@ namespace OnlineUserPool.ViewModels case 0: { var client = Clients.FirstOrDefault(n => n.Equals(remoteIpEndPoint)); + if(client == null) return; client.LastActiveTime = DateTime.Now; if (msg.V > 0) { @@ -159,6 +160,7 @@ namespace OnlineUserPool.ViewModels case 1: { var client = Clients.FirstOrDefault(n => n.Equals(remoteIpEndPoint)); + if(client == null) return; var msg1 = (msg as MsgModel); client.Competitionid = msg1.CompetitionId; client.Model = msg1.Model; @@ -542,13 +544,15 @@ namespace OnlineUserPool.ViewModels { RoomList.Remove(room); } + + //发送信息给当前房间内的人 + SendGameRoomMessage(room); + var mine = Clients.FirstOrDefault(c => c.MemberId == msg1.UserId); if (mine != null) { mine.RoomId = 0; } - //发送信息给当前房间内的人 - SendGameRoomMessage(room); } }