From f32affc00afcc94276cb37a44d8a2ae8a3449368 Mon Sep 17 00:00:00 2001 From: Passive <20432486+PassiveModding@users.noreply.github.com> Date: Mon, 16 Oct 2023 13:09:03 +1100 Subject: [PATCH] Fix index out of bounds breaking when loading custom models --- src/Lumina/Models/Models/Submesh.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Lumina/Models/Models/Submesh.cs b/src/Lumina/Models/Models/Submesh.cs index 1457905c..f19dd4fb 100644 --- a/src/Lumina/Models/Models/Submesh.cs +++ b/src/Lumina/Models/Models/Submesh.cs @@ -54,6 +54,8 @@ public Submesh( Model model, int meshIndex, int subMeshIndex ) int boneEndIndex = currentSubMesh.BoneStartIndex + currentSubMesh.BoneCount; for( int i = currentSubMesh.BoneStartIndex; i < boneEndIndex; i++ ) { + // only run if boneIndex is valid + if( i >= model.File.SubmeshBoneMap.Length ) continue; var boneIndex = model.File.SubmeshBoneMap[ i ]; var boneOffset = model.File.BoneNameOffsets[ boneIndex ]; string boneName = model.StringOffsetToStringMap[ (int) boneOffset ];