Physical animation component causing a crash

The physical animation component is crashing the game on start or at a random point after starting. It tries to get a return from that SpaceBases array with the BoneIndex but the SpaceBases array is empty.

Here it creates the SpaceBases:


image

I added a simple if check to the source code after the SpaceBases is created so that it doesn’t cause a crash but it still ofc gives me an error about every 1.5-2 seconds and on that frame it doesn’t update the position because of the return so it stutters a lot. I don’t know what could be causing it. When I add an empty animation bluprint to the character it doesn’t give me an error.

const TArray<FTransform>& SpaceBases = SkeletalMeshComponent->GetEditableComponentSpaceTransforms();
        if (SpaceBases.Num() == 0)
        {
            UE_LOG(LogTemp, Error, TEXT("SpaceBases array is empty"));
            return;
        }