From 0cef70a3c032069fb95733be7c9ae05dbd184513 Mon Sep 17 00:00:00 2001 From: Marc Gilleron Date: Wed, 21 Apr 2021 18:29:23 +0100 Subject: [PATCH] Fix backward iteration infinite loop when there is only one LOD --- terrain/voxel_lod_terrain.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/terrain/voxel_lod_terrain.cpp b/terrain/voxel_lod_terrain.cpp index abb3d780..dfda7fcb 100644 --- a/terrain/voxel_lod_terrain.cpp +++ b/terrain/voxel_lod_terrain.cpp @@ -969,7 +969,7 @@ void VoxelLodTerrain::_process(float delta) { // Ignore largest lod because it can extend a little beyond due to the view distance setting. // Instead, those blocks are unloaded by the octree forest management. // Iterating from big to small LOD so we can exit earlier if bounds don't intersect. - for (unsigned int lod_index = get_lod_count() - 2; lod_index >= 0; --lod_index) { + for (int lod_index = static_cast(get_lod_count()) - 2; lod_index >= 0; --lod_index) { VOXEL_PROFILE_SCOPE(); Lod &lod = _lods[lod_index]; @@ -1053,7 +1053,7 @@ void VoxelLodTerrain::_process(float delta) { // Ignore largest lod because it can extend a little beyond due to the view distance setting. // Instead, those blocks are unloaded by the octree forest management. // Iterating from big to small LOD so we can exit earlier if bounds don't intersect. - for (unsigned int lod_index = get_lod_count() - 2; lod_index >= 0; --lod_index) { + for (int lod_index = static_cast(get_lod_count()) - 2; lod_index >= 0; --lod_index) { VOXEL_PROFILE_SCOPE(); Lod &lod = _lods[lod_index];