Second Element of TArray Changing When Passed by Ref?

So I have a FCompactPose OutPose which holds a struct variable of it’s parent class FBaseCompactPose SourcePose.

In AnimNodeSequencePlayer::Evaluate_AnyThread(), I create an FBoneContainer which contains a TArray SkeletonToCompactPose, which is essentially just an array of int32 representing each bone in a skeleton.

Upon initialization, it has the correct number of bones with correct indices. This FBoneContainer is then stored in OutPose.SourcePose

Next, GetAnimationPose(FCompactPose& OutPose) is called, which then calls GetBonePose(FCompactPose& OutPose).

In GetBonePose(FCompactPose& OutPose), a new const FBoneContainer& RequiredBones is set to equal OutPose.SourcePose.GetFBoneContainer().

In this case, in a skeleton with 80 bones FCompactPoseBoneIndex and SkeletonBoneIndex should both equal 0 up to 79. When the FBoneContainer is initialized this is true. But in AnimSequence::GetBonePose(FCompactPose& OutPose), FCompactPoseBoneIndex at SkeletonBoneIndex of 1 equals a random number in the 100s, once 714, another time 652. But only the value at the index of 1, all other indices are as they should be.

This is how it’s accessed:

const FCompactPoseBoneIndex BoneIndex = RequiredBones.GetCompactPoseIndexFromSkeletonIndex(SkeletonBoneIndex);
//Nasty, we break our type safety, code in the lower levels should be adjusted for this
const int32 CompactPoseBoneIndex = BoneIndex.GetInt();
UE_LOG(LogTemp, Warning, TEXT("CompactPoseBoneIndex: %d, SkeletonBoneIndex: %d. AnimSequence::GetBonePose()"), CompactPoseBoneIndex, SkeletonBoneIndex); 

How could this single index, which isn’t even the very first index in the array, be changed but not the others?

The SourcePose variable in OutPose is not UPROPERTY(), so I thought maybe it might be getting garbage collected, but all the other values are saved and correct.
Any help is appreciated!

In the beginning of GetBonePose(), FBoneContainer& RequiredBones = OutPose.SourcePose.GetBoneContainer().

For

const FCompactPoseBoneIndex BoneIndex = RequiredBones.GetCompactPoseIndexFromSkeletonIndex(SkeletonBoneIndex);

replacing RequiredBones with an FBoneContainer initialized in GetBonePose fixes the issue.

This is only a workaround though, I don’t want to be initializing a new bonecontainer each frame.

Any insight?