fix NullReferenceExceptions during client pings

This commit is contained in:
Matthias Mailänder
2015-06-06 13:13:01 +02:00
parent 1651bd817b
commit e228601a5c
2 changed files with 15 additions and 4 deletions

View File

@@ -489,7 +489,11 @@ namespace OpenRA.Server
break;
}
var pingFromClient = LobbyInfo.PingFromClient(GetClient(conn));
var client = GetClient(conn);
if (client == null)
return;
var pingFromClient = LobbyInfo.PingFromClient(client);
if (pingFromClient == null)
return;

View File

@@ -186,8 +186,11 @@ namespace OpenRA.Mods.Common.Server
server.LobbyInfo.Clients.Remove(occupant);
server.SyncLobbyClients();
var ping = server.LobbyInfo.PingFromClient(occupant);
server.LobbyInfo.ClientPings.Remove(ping);
server.SyncClientPing();
if (ping != null)
{
server.LobbyInfo.ClientPings.Remove(ping);
server.SyncClientPing();
}
}
else
{
@@ -221,7 +224,11 @@ namespace OpenRA.Mods.Common.Server
{
server.LobbyInfo.Clients.Remove(occupant);
var ping = server.LobbyInfo.PingFromClient(occupant);
server.LobbyInfo.ClientPings.Remove(ping);
if (ping != null)
{
server.LobbyInfo.ClientPings.Remove(ping);
server.SyncClientPing();
}
}
server.SyncLobbyClients();