Fix segfault when generating stuff on world boundaries

This commit is contained in:
Perttu Ahola 2012-01-01 21:01:55 +02:00
parent 7b7b68cdab
commit 81d3485109

@ -249,7 +249,7 @@ void * EmergeThread::Thread()
t.stop(true); // Hide output t.stop(true); // Hide output
} }
{ do{ // enable break
// Lock environment again to access the map // Lock environment again to access the map
JMutexAutoLock envlock(m_server->m_env_mutex); JMutexAutoLock envlock(m_server->m_env_mutex);
@ -263,6 +263,11 @@ void * EmergeThread::Thread()
// Get central block // Get central block
block = map.getBlockNoCreateNoEx(p); block = map.getBlockNoCreateNoEx(p);
// If block doesn't exist, don't try doing anything with it
// This happens if the block is not in generation boundaries
if(!block)
break;
/* /*
Do some post-generate stuff Do some post-generate stuff
*/ */
@ -285,7 +290,7 @@ void * EmergeThread::Thread()
// Activate objects and stuff // Activate objects and stuff
m_server->m_env->activateBlock(block, 0); m_server->m_env->activateBlock(block, 0);
} }while(false);
} }
if(block == NULL) if(block == NULL)