Fixes #4098 ce8a9ed didn't quite go far enough, and left this bug in

master
gregorycu 2016-05-08 19:02:11 +10:00 committed by Craig Robbins
parent 2cdd9b4ab6
commit b8aed9dfc2
1 changed files with 5 additions and 3 deletions

View File

@ -1846,7 +1846,7 @@ void Server::SendPlayerHP(u16 peer_id)
{ {
DSTACK(FUNCTION_NAME); DSTACK(FUNCTION_NAME);
PlayerSAO *playersao = getPlayerSAO(peer_id); PlayerSAO *playersao = getPlayerSAO(peer_id);
// In some rare case, if the player is disconnected // In some rare case if the player is disconnected
// while Lua call l_punch, for example, this can be NULL // while Lua call l_punch, for example, this can be NULL
if (!playersao) if (!playersao)
return; return;
@ -2515,9 +2515,11 @@ void Server::sendDetachedInventories(u16 peer_id)
void Server::DiePlayer(u16 peer_id) void Server::DiePlayer(u16 peer_id)
{ {
DSTACK(FUNCTION_NAME); DSTACK(FUNCTION_NAME);
PlayerSAO *playersao = getPlayerSAO(peer_id); PlayerSAO *playersao = getPlayerSAO(peer_id);
assert(playersao); // In some rare cases this can be NULL -- if the player is disconnected
// when a Lua function modifies l_punch, for example
if (!playersao)
return;
infostream << "Server::DiePlayer(): Player " infostream << "Server::DiePlayer(): Player "
<< playersao->getPlayer()->getName() << playersao->getPlayer()->getName()