Skip to content

Commit

Permalink
Fix index out of bounds breaking when loading custom models
Browse files Browse the repository at this point in the history
  • Loading branch information
PassiveModding committed Oct 16, 2023
1 parent 0f14a99 commit f32affc
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/Lumina/Models/Models/Submesh.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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 ];
Expand Down

0 comments on commit f32affc

Please sign in to comment.