Skip to content

Commit b8aed9d

Browse files
gregorycuZeno-
authored andcommitted
Fixes #4098 ce8a9ed didn't quite go far enough, and left this bug in
1 parent 2cdd9b4 commit b8aed9d

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/server.cpp

+5-3
Original file line numberDiff line numberDiff line change
@@ -1846,7 +1846,7 @@ void Server::SendPlayerHP(u16 peer_id)
18461846
{
18471847
DSTACK(FUNCTION_NAME);
18481848
PlayerSAO *playersao = getPlayerSAO(peer_id);
1849-
// In some rare case, if the player is disconnected
1849+
// In some rare case if the player is disconnected
18501850
// while Lua call l_punch, for example, this can be NULL
18511851
if (!playersao)
18521852
return;
@@ -2515,9 +2515,11 @@ void Server::sendDetachedInventories(u16 peer_id)
25152515
void Server::DiePlayer(u16 peer_id)
25162516
{
25172517
DSTACK(FUNCTION_NAME);
2518-
25192518
PlayerSAO *playersao = getPlayerSAO(peer_id);
2520-
assert(playersao);
2519+
// In some rare cases this can be NULL -- if the player is disconnected
2520+
// when a Lua function modifies l_punch, for example
2521+
if (!playersao)
2522+
return;
25212523

25222524
infostream << "Server::DiePlayer(): Player "
25232525
<< playersao->getPlayer()->getName()

0 commit comments

Comments
 (0)