summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2021-11-02 15:37:42 +0100
committerGitHub <noreply@github.com>2021-11-02 15:37:42 +0100
commitfe6c65a1a82ceb66fc15c3e76a01e17cb7fede22 (patch)
treede5630156c13e28cacbd4bc524dc5ac44fa1be37
parent63d4ac2a3c00cf2ab8ff569aa1c41f4fb3115555 (diff)
parent26fe4c78624615fe4e45ea8907630f3b55fdb00a (diff)
Merge pull request #54511 from pycbouh/meshtool-fix-bones-crash
-rw-r--r--scene/resources/mesh_data_tool.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/scene/resources/mesh_data_tool.cpp b/scene/resources/mesh_data_tool.cpp
index 04b2437ae8..9ecd8ec2f3 100644
--- a/scene/resources/mesh_data_tool.cpp
+++ b/scene/resources/mesh_data_tool.cpp
@@ -421,6 +421,7 @@ Vector<int> MeshDataTool::get_vertex_bones(int p_idx) const {
void MeshDataTool::set_vertex_bones(int p_idx, const Vector<int> &p_bones) {
ERR_FAIL_INDEX(p_idx, vertices.size());
+ ERR_FAIL_COND(p_bones.size() != 4);
vertices.write[p_idx].bones = p_bones;
format |= Mesh::ARRAY_FORMAT_BONES;
}
@@ -432,6 +433,7 @@ Vector<float> MeshDataTool::get_vertex_weights(int p_idx) const {
void MeshDataTool::set_vertex_weights(int p_idx, const Vector<float> &p_weights) {
ERR_FAIL_INDEX(p_idx, vertices.size());
+ ERR_FAIL_COND(p_weights.size() != 4);
vertices.write[p_idx].weights = p_weights;
format |= Mesh::ARRAY_FORMAT_WEIGHTS;
}