diff --git a/OpenRA.Game/Server/Server.cs b/OpenRA.Game/Server/Server.cs index cf921d35bb..d1a7001bfe 100644 --- a/OpenRA.Game/Server/Server.cs +++ b/OpenRA.Game/Server/Server.cs @@ -263,15 +263,18 @@ namespace OpenRA.Server case "Chat": case "TeamChat": + var fromClient = GetClient(conn); + var fromIndex = fromClient != null ? fromClient.Index : 0; + foreach (var c in conns.Except(conn).ToArray()) - DispatchOrdersToClient(c, GetClient(conn).Index, 0, so.Serialize()); + DispatchOrdersToClient(c, fromIndex, 0, so.Serialize()); break; } } public Session.Client GetClient(Connection conn) { - return lobbyInfo.Clients.First(c => c.Index == conn.PlayerIndex); + return lobbyInfo.ClientWithIndex(conn.PlayerIndex); } public void DropClient(Connection toDrop, Exception e) diff --git a/OpenRA.Mods.RA/ServerTraits/LobbyCommands.cs b/OpenRA.Mods.RA/ServerTraits/LobbyCommands.cs index d288ba4c7a..c5bb5dba45 100644 --- a/OpenRA.Mods.RA/ServerTraits/LobbyCommands.cs +++ b/OpenRA.Mods.RA/ServerTraits/LobbyCommands.cs @@ -285,7 +285,7 @@ namespace OpenRA.Mods.RA.Server }; var slotData = server.lobbyInfo.Slots.FirstOrDefault( x => x.Index == client.Slot ); - if (slotData != null) + if (slotData != null && slotData.MapPlayer != null) SyncClientToPlayerReference(client, server.Map.Players[slotData.MapPlayer]); server.lobbyInfo.Clients.Add(client);