From 46e5611630862f3d97ce212a675d8ac65cfdf4ed Mon Sep 17 00:00:00 2001 From: fallenoak Date: Thu, 25 Dec 2025 22:19:48 -0600 Subject: [PATCH] fix(model): correct binary search behavior in CM2Model::FindKey --- src/model/CM2Model.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/model/CM2Model.cpp b/src/model/CM2Model.cpp index 3756ec9..0e28a07 100644 --- a/src/model/CM2Model.cpp +++ b/src/model/CM2Model.cpp @@ -950,7 +950,7 @@ void CM2Model::FindKey(M2ModelBoneSeq* sequence, const M2TrackBase& track, uint3 // Perform binary search for key containing sequence time int32_t lowKey = 0; - int32_t highKey = numKeys; + int32_t highKey = numKeys - 1; while (lowKey < highKey) { int32_t midKey = (lowKey + highKey) / 2;