aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgregorycu <gregory.currie@gmail.com>2016-05-08 19:02:11 +1000
committerCraig Robbins <kde.psych@gmail.com>2016-05-08 19:03:09 +1000
commitb8aed9dfc2ae5e1c877707c856b061ee76b0e1c4 (patch)
treebcb2a56ceea0e8feccd99386b447d8db58e2530d
parent2cdd9b4ab6cfc878dafb88aa8446b12cf2f94278 (diff)
downloadminetest-b8aed9dfc2ae5e1c877707c856b061ee76b0e1c4.tar.gz
minetest-b8aed9dfc2ae5e1c877707c856b061ee76b0e1c4.tar.bz2
minetest-b8aed9dfc2ae5e1c877707c856b061ee76b0e1c4.zip
Fixes #4098 ce8a9ed didn't quite go far enough, and left this bug in
-rw-r--r--src/server.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/server.cpp b/src/server.cpp
index 0aba2796c..a3b686c25 100644
--- a/src/server.cpp
+++ b/src/server.cpp
@@ -1846,7 +1846,7 @@ void Server::SendPlayerHP(u16 peer_id)
{
DSTACK(FUNCTION_NAME);
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
if (!playersao)
return;
@@ -2515,9 +2515,11 @@ void Server::sendDetachedInventories(u16 peer_id)
void Server::DiePlayer(u16 peer_id)
{
DSTACK(FUNCTION_NAME);
-
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 "
<< playersao->getPlayer()->getName()