connection removal safety
This commit is contained in:
@@ -161,7 +161,9 @@ void Server::BroadcastPacket(const protocol::Packet* packet) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Server::RemoveConnexion(std::uint8_t connexionID) {
|
void Server::RemoveConnexion(std::uint8_t connexionID) {
|
||||||
GetPlayers().erase(GetPlayers().find(connexionID));
|
auto it = GetPlayers().find(connexionID);
|
||||||
|
if (it != GetPlayers().end())
|
||||||
|
GetPlayers().erase(it);
|
||||||
m_Connections.erase(connexionID);
|
m_Connections.erase(connexionID);
|
||||||
m_Lobby.OnPlayerLeave(connexionID);
|
m_Lobby.OnPlayerLeave(connexionID);
|
||||||
OnPlayerLeave(connexionID);
|
OnPlayerLeave(connexionID);
|
||||||
|
|||||||
Reference in New Issue
Block a user