diff options
author | Perttu Ahola <celeron55@gmail.com> | 2012-01-01 21:01:55 +0200 |
---|---|---|
committer | Perttu Ahola <celeron55@gmail.com> | 2012-01-01 21:01:55 +0200 |
commit | 81d348510924b7782ee06f65da63499b3a7e1eb5 (patch) | |
tree | 298a62a45e560c96228e5351c71f34f1168b6c66 | |
parent | 7b7b68cdabf1e34e74b9157315998aa40777251b (diff) | |
download | minetest-81d348510924b7782ee06f65da63499b3a7e1eb5.tar.gz minetest-81d348510924b7782ee06f65da63499b3a7e1eb5.tar.bz2 minetest-81d348510924b7782ee06f65da63499b3a7e1eb5.zip |
Fix segfault when generating stuff on world boundaries
-rw-r--r-- | src/server.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/server.cpp b/src/server.cpp index 68a84b248..4a0e952a8 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -249,7 +249,7 @@ void * EmergeThread::Thread() t.stop(true); // Hide output } - { + do{ // enable break // Lock environment again to access the map JMutexAutoLock envlock(m_server->m_env_mutex); @@ -262,6 +262,11 @@ void * EmergeThread::Thread() // Get central block 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 @@ -285,7 +290,7 @@ void * EmergeThread::Thread() // Activate objects and stuff m_server->m_env->activateBlock(block, 0); - } + }while(false); } if(block == NULL) |