mirror of
https://github.com/luanti-org/luanti.git
synced 2025-10-21 20:05:45 +02:00
Avoid packets getting sent to disconnected players (#14444)
Many functions expect RemotePlayer to have a valid peer ID, this however is not the case immediately after disconnecting where the object is still alive and pending for removal. ServerEnvironment::getPlayer(const char *, bool) now only returns players that are connected unless forced to.
This commit is contained in:
@@ -179,7 +179,7 @@ void Server::handleCommand_Init(NetworkPacket* pkt)
|
||||
return;
|
||||
}
|
||||
|
||||
RemotePlayer *player = m_env->getPlayer(playername);
|
||||
RemotePlayer *player = m_env->getPlayer(playername, true);
|
||||
|
||||
// If player is already connected, cancel
|
||||
if (player && player->getPeerId() != PEER_ID_INEXISTENT) {
|
||||
|
Reference in New Issue
Block a user