Keep getting engine.dll runtime errors

I keep getting “(UnrealEditor-Engine.dll) in UnrealEditor.exe: 0xC0000005” read access violation error in this finction. The class is inherited from Character class

#include "AIController.h"
#include "Components/SkeletalMeshComponent.h"
#include "PhysicsEngine/PhysicalAnimationComponent.h"
#include "Components/CapsuleComponent.h"
void ACPP_EnemyBase::Die()
	bIsDead = true;
	GetMesh()->bPauseAnims = true;
	PhysicalAnimationComponent->ApplyPhysicalAnimationProfileBelow(BoneNamePA, FName("Falling"), false);
	GetMesh()->SetAllBodiesBelowSimulatePhysics(BoneName, true); //Here
	GetCapsuleComponent()->SetCollisionEnabled(ECollisionEnabled::NoCollision); //Or here

I tried storing mesh and capsule components in variables but it didn’t help

Does the character have an AI controller, mesh, and capsule in the editor/when you play the game?

I’m converting fully working npc to c++, so yes it has everything. And shouldn’t a child class of the Character class have it by default?

When does Die() get called? It’s possible the character has been left in a bad state.

I’d advise running from Visual Studio in DebugGame Editor config with engine source installed. You’ll breakpoint when the crash occurs and can see what’s actually happening - presumably something is null that you’re not expecting to be null.