summaryrefslogtreecommitdiff
path: root/src/map.cpp
diff options
context:
space:
mode:
authorPerttu Ahola <celeron55@gmail.com>2015-08-13 19:02:48 +0300
committerPerttu Ahola <celeron55@gmail.com>2015-08-13 19:02:48 +0300
commitdef274a583909a695580509028bd2f393b9c5cf9 (patch)
tree5950621fb765d74eb76e4dac1a2e2f044ef7d5ed /src/map.cpp
parenta8e238ed06ee8285ed4459e9deda3117419837f6 (diff)
downloadminetest-def274a583909a695580509028bd2f393b9c5cf9.tar.gz
minetest-def274a583909a695580509028bd2f393b9c5cf9.tar.bz2
minetest-def274a583909a695580509028bd2f393b9c5cf9.zip
Fix segfault caused by a8e238ed06ee8285ed4459e9deda3117419837f6
Diffstat (limited to 'src/map.cpp')
-rw-r--r--src/map.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/map.cpp b/src/map.cpp
index 38a700e3c..76a558d43 100644
--- a/src/map.cpp
+++ b/src/map.cpp
@@ -1499,8 +1499,8 @@ void Map::timerUpdate(float dtime, float unload_timeout, u32 max_loaded_blocks,
}
block_count_all = mapblock_queue.size();
// Delete old blocks, and blocks over the limit from the memory
- while (mapblock_queue.size() > max_loaded_blocks
- || mapblock_queue.top().block->getUsageTimer() > unload_timeout) {
+ while (!mapblock_queue.empty() && (mapblock_queue.size() > max_loaded_blocks
+ || mapblock_queue.top().block->getUsageTimer() > unload_timeout)) {
TimeOrderedMapBlock b = mapblock_queue.top();
mapblock_queue.pop();