diff options
author | Perttu Ahola <celeron55@gmail.com> | 2012-04-14 18:46:10 +0300 |
---|---|---|
committer | Perttu Ahola <celeron55@gmail.com> | 2012-04-14 18:46:10 +0300 |
commit | 0aeb5adb8f650c57758539c9025d92305096bd64 (patch) | |
tree | 968c28ea913cfe96e60673f5dee69b1ac62a298a | |
parent | 9c5cc217bfe5a65d412b4b1d193689bc07d61b44 (diff) | |
download | minetest-0aeb5adb8f650c57758539c9025d92305096bd64.tar.gz minetest-0aeb5adb8f650c57758539c9025d92305096bd64.tar.bz2 minetest-0aeb5adb8f650c57758539c9025d92305096bd64.zip |
Fix continuing to process TOSERVER_INIT2 even if player doesn't exist
-rw-r--r-- | src/server.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/server.cpp b/src/server.cpp index b0a0fb6fd..522916a2f 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -2176,6 +2176,12 @@ void Server::ProcessData(u8 *data, u32 datasize, u16 peer_id) verbosestream<<"Server: Got TOSERVER_INIT2 from " <<peer_id<<std::endl; + Player *player = m_env->getPlayer(peer_id); + if(!player){ + verbosestream<<"Server: TOSERVER_INIT2: " + <<"Player not found; ignoring."<<std::endl; + return; + } getClient(peer_id)->serialization_version = getClient(peer_id)->pending_serialization_version; @@ -2203,8 +2209,6 @@ void Server::ProcessData(u8 *data, u32 datasize, u16 peer_id) UpdateCrafting(peer_id); SendInventory(peer_id); - Player *player = m_env->getPlayer(peer_id); - // Send HP SendPlayerHP(peer_id); |