From 6b6c9639f97f6f38b22319e9f4c35b6f03cec37d Mon Sep 17 00:00:00 2001 From: Bob Date: Tue, 12 Oct 2010 20:32:33 +1300 Subject: [PATCH] fix crash wrt chat in lobby --- OpenRA.Game/Network/Session.cs | 2 +- OpenRA.Game/Network/UnitOrders.cs | 12 ++++-------- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/OpenRA.Game/Network/Session.cs b/OpenRA.Game/Network/Session.cs index 9072c6537e..cf70100ea0 100644 --- a/OpenRA.Game/Network/Session.cs +++ b/OpenRA.Game/Network/Session.cs @@ -23,7 +23,7 @@ namespace OpenRA.Network public Client ClientWithIndex( int clientID ) { - return Clients.Single( c => c.Index == clientID ); + return Clients.SingleOrDefault( c => c.Index == clientID ); } public Client ClientInSlot( Slot slot ) diff --git a/OpenRA.Game/Network/UnitOrders.cs b/OpenRA.Game/Network/UnitOrders.cs index d106b5b3da..05f85a51bb 100755 --- a/OpenRA.Game/Network/UnitOrders.cs +++ b/OpenRA.Game/Network/UnitOrders.cs @@ -36,14 +36,10 @@ namespace OpenRA.Network case "Chat": { var client = orderManager.LobbyInfo.ClientWithIndex( clientId ); - if (client != null) - { - var player = world.FindPlayerByClientId(clientId); - if (player != null && player.WinState == WinState.Lost) - Game.AddChatLine(client.Color1, client.Name + " (Dead)", order.TargetString); - else - Game.AddChatLine(client.Color1, client.Name, order.TargetString); - } + if( client != null ) + Game.AddChatLine( client.Color1, client.Name, order.TargetString ); + else + Game.AddChatLine( Color.White, "(player {0})".F( clientId ), order.TargetString ); break; } case "TeamChat":