From a78c32e57aa5a079886a4bbcde1cd02440a688a6 Mon Sep 17 00:00:00 2001 From: Marc Gilleron Date: Sat, 10 Aug 2024 21:00:54 +0100 Subject: [PATCH] Fix error when removing items from a VoxelInstanceLibrary --- doc/source/changelog.md | 1 + terrain/instancing/voxel_instance_library.cpp | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/doc/source/changelog.md b/doc/source/changelog.md index 2b464ec50..4baa3ba99 100644 --- a/doc/source/changelog.md +++ b/doc/source/changelog.md @@ -33,6 +33,7 @@ Primarily developped with Godot 4.3. - Fixed slow loading when the database path contains `res://` or `user://` - Fixed crash if the database has an invalid path and `flush()` is called after `set_key_cache_enabled(true)` - `VoxelInstancer`: Fixed instances with LOD > 0 were generated on `VoxelTerrain` even though LOD isn't supported (ending up in weird positions). No instances should generate. + - `VoxelInstanceLibrary`: Fixed `Assertion failed: "p_id < 0 || p_id >= MAX_ID" is false` when removing items from a VoxelInstanceLibrary - `VoxelMeshSDF`: Fixed error in the editor when trying to visualize the last slice (which turns out to be off by 1) - `VoxelModifierMesh`: - Fixed setting `isolevel` had no effect diff --git a/terrain/instancing/voxel_instance_library.cpp b/terrain/instancing/voxel_instance_library.cpp index 12e87a237..005f2d6de 100644 --- a/terrain/instancing/voxel_instance_library.cpp +++ b/terrain/instancing/voxel_instance_library.cpp @@ -51,7 +51,7 @@ void VoxelInstanceLibrary::add_item(int p_id, Ref item } void VoxelInstanceLibrary::remove_item(int p_id) { - ZN_ASSERT_RETURN(p_id < 0 || p_id >= MAX_ID); + ZN_ASSERT_RETURN(p_id >= 0 && p_id < MAX_ID); const unsigned int id = p_id; auto it = _items.find(id); ERR_FAIL_COND_MSG(it == _items.end(), "Cannot remove unregistered item");