Browse Source

Merge pull request #73157 from akien-mga/surfacetool-commit-crash

Fix SurfaceTool crash with invalid bone/weight count
Yuri Sizov 2 years ago
parent
commit
72c5b56d04
1 changed files with 2 additions and 2 deletions
  1. 2 2
      scene/resources/surface_tool.cpp

+ 2 - 2
scene/resources/surface_tool.cpp

@@ -648,7 +648,7 @@ Array SurfaceTool::commit_to_arrays() {
 				for (uint32_t idx = 0; idx < vertex_array.size(); idx++) {
 					const Vertex &v = vertex_array[idx];
 
-					if (v.bones.size() > count) {
+					if (v.bones.size() != count) {
 						ERR_PRINT_ONCE(vformat("Invalid bones size %d vs count %d", v.bones.size(), count));
 						continue;
 					}
@@ -672,7 +672,7 @@ Array SurfaceTool::commit_to_arrays() {
 				for (uint32_t idx = 0; idx < vertex_array.size(); idx++) {
 					const Vertex &v = vertex_array[idx];
 
-					if (v.weights.size() > count) {
+					if (v.weights.size() != count) {
 						ERR_PRINT_ONCE(vformat("Invalid weight size %d vs count %d", v.weights.size(), count));
 						continue;
 					}