projects
/
oweals
/
minetest.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
0a41326
)
Fix a rare crash case un SendPlayerHP
author
Ner'zhul
<nerzhul@users.noreply.github.com>
Sat, 11 Apr 2015 08:07:23 +0000
(10:07 +0200)
committer
Ner'zhul
<nerzhul@users.noreply.github.com>
Sat, 11 Apr 2015 08:07:23 +0000
(10:07 +0200)
If the player is disconnected while Lua API is doing a l_punch call, for example, the playersao is NULL and the server crash. Fix it.
src/server.cpp
patch
|
blob
|
history
diff --git
a/src/server.cpp
b/src/server.cpp
index 6597ee64f89a043d2c3fb801ea3d79290f2c9fd7..4d593820576664b2c73bdd73512f8225db7a41bf 100644
(file)
--- a/
src/server.cpp
+++ b/
src/server.cpp
@@
-1802,7
+1802,11
@@
void Server::SendPlayerHP(u16 peer_id)
{
DSTACK(__FUNCTION_NAME);
PlayerSAO *playersao = getPlayerSAO(peer_id);
- assert(playersao);
+ // In some rare case, if the player is disconnected
+ // while Lua call l_punch, for example, this can be NULL
+ if (!playersao)
+ return;
+
SendHP(peer_id, playersao->getHP());
m_script->player_event(playersao,"health_changed");