Fix github issue #224
authorPerttu Ahola <celeron55@gmail.com>
Sat, 1 Sep 2012 15:32:15 +0000 (18:32 +0300)
committerPerttu Ahola <celeron55@gmail.com>
Sat, 1 Sep 2012 15:32:15 +0000 (18:32 +0300)
src/server.cpp

index ba99f47071f74a1db4d0abe5feb687f38e9d55e2..2da9cbe24496253a7caddddc9b52d8ec08b5635d 100644 (file)
@@ -442,9 +442,12 @@ void RemoteClient::GetNextBlocks(Server *server, float dtime,
        m_nearest_unsent_reset_timer += dtime;
        
        if(m_nothing_to_send_pause_timer >= 0)
-       {
                return;
-       }
+
+       Player *player = server->m_env->getPlayer(peer_id);
+       // This can happen sometimes; clients and players are not in perfect sync.
+       if(player == NULL)
+               return;
 
        // Won't send anything if already sending
        if(m_blocks_sending.size() >= g_settings->getU16
@@ -456,10 +459,6 @@ void RemoteClient::GetNextBlocks(Server *server, float dtime,
 
        //TimeTaker timer("RemoteClient::GetNextBlocks");
        
-       Player *player = server->m_env->getPlayer(peer_id);
-
-       assert(player != NULL);
-
        v3f playerpos = player->getPosition();
        v3f playerspeed = player->getSpeed();
        v3f playerspeeddir(0,0,0);