diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2021-08-02 18:19:06 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-02 18:19:06 +0200 |
commit | 51fac9e3c7192592081f1fe8979441ab8ff65224 (patch) | |
tree | 8be17b7b4ca14ab2899f550b7ceca1ba5a80af39 | |
parent | cbfe6a41801449cf8f8dd343f9f76ee7dac9f7c4 (diff) | |
parent | 0c879ab28828afdffe0f6a8effb1830fd814868e (diff) |
Merge pull request #51187 from timothyqiu/vertex-index-3
Fix crash when number of indices to optimize is not a multiple of 3
-rw-r--r-- | scene/resources/surface_tool.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/scene/resources/surface_tool.cpp b/scene/resources/surface_tool.cpp index 9f8c35b668..875aa30824 100644 --- a/scene/resources/surface_tool.cpp +++ b/scene/resources/surface_tool.cpp @@ -1120,6 +1120,7 @@ SurfaceTool::CustomFormat SurfaceTool::get_custom_format(int p_index) const { void SurfaceTool::optimize_indices_for_cache() { ERR_FAIL_COND(optimize_vertex_cache_func == nullptr); ERR_FAIL_COND(index_array.size() == 0); + ERR_FAIL_COND(index_array.size() % 3 != 0); LocalVector old_index_array = index_array; memset(index_array.ptr(), 0, index_array.size() * sizeof(int)); |