Verify that we won't call a method on a non-existant element.
This seems to be the root of a handfull of crashes.
This commit is contained in:
@@ -515,6 +515,7 @@ void StepManiaLanServer::SendStatsToClients()
|
||||
|
||||
void StepManiaLanServer::SendNetPacket(const unsigned int client, PacketFunctions& Packet)
|
||||
{
|
||||
if ( client < Client.size() )
|
||||
Client[client]->clientSocket.SendPack((char*)Packet.Data, Packet.Position);
|
||||
}
|
||||
|
||||
@@ -592,6 +593,7 @@ void StepManiaLanServer::NewClientCheck()
|
||||
|
||||
void StepManiaLanServer::SendValue(uint8_t value, const unsigned int clientNum)
|
||||
{
|
||||
if ( clientNum < Client.size() )
|
||||
Client[clientNum]->clientSocket.SendPack((char*)&value, sizeof(uint8_t));
|
||||
}
|
||||
|
||||
@@ -814,6 +816,7 @@ void StepManiaLanServer::ServerChat(const CString& message)
|
||||
bool StepManiaLanServer::CheckConnection(const unsigned int clientNum)
|
||||
{
|
||||
//If there is an error close the socket.
|
||||
if ( clientNum < Client.size() )
|
||||
if (Client[clientNum]->clientSocket.IsError())
|
||||
{
|
||||
Disconnect(clientNum);
|
||||
|
||||
Reference in New Issue
Block a user