Fix potential crash.

This commit is contained in:
Relintai 2022-03-18 17:19:59 +01:00
parent 3e97039c99
commit cc52a10ac7
2 changed files with 4 additions and 0 deletions

View File

@ -258,6 +258,8 @@ void CharacterSkeleton2D::add_model_visual_entry(Ref<ModelVisual> vis, Ref<Model
int target_bone_idx = ive->get_bone();
ERR_FAIL_INDEX(target_bone_idx, _entries.size());
Vector<Ref<SkeletonModelEntry>> &entries = _entries.write[target_bone_idx];
for (int i = 0; i < entries.size(); ++i) {

View File

@ -298,6 +298,8 @@ void CharacterSkeleton3D::add_model_visual_entry(Ref<ModelVisual> vis, Ref<Model
int target_bone_idx = ive->get_bone();
ERR_FAIL_INDEX(target_bone_idx, _entries.size());
Vector<Ref<SkeletonModelEntry>> &entries = _entries.write[target_bone_idx];
for (int i = 0; i < entries.size(); ++i) {