Game crashes when checking Event Instigator "TakeDamage"

When trying to check the event instigator to make the hit enemy turn to the damage location, the game crashes. I am not sure why.

float ABM_EnemyPawn::TakeDamage(float DamageAmount, struct FDamageEvent const& DamageEvent, class AController* EventInstigator, AActor* DamageCauser)
{
	Super::TakeDamage(DamageAmount, DamageEvent, EventInstigator, DamageCauser);

	Health -= DamageAmount;

	if (Health <= 0)
	{
		//...Die
		PlayDeath();
		bDead = true;
		return DamageAmount; //Return modified damage

	}
	else
	{
		this->PlayAnimMontage(TakeDamageAnim, 1.0);

		//Rotate to hit location
		if (EventInstigator->GetOwner() != NULL) // Problem statements
		{
			FRotator HitRotation = FVector(EventInstigator->GetOwner()->GetActorLocation() - this->GetActorLocation()).Rotation();

			HitRotation.Pitch = 0;
			HitRotation.Roll = 0;

			this->SetActorRotation(HitRotation);
		}

		this->GetMovementComponent()->StopMovementImmediately();

		return DamageAmount; //Return modified damage
	}
}

This is the crash log

Unhandled Exception: EXCEPTION_ACCESS_VIOLATION reading address 0x00000098

UE4Editor-Engine.dll!UnknownFunction (0x00007ffe5b683670) + 0 bytes [UnknownFile:0]
UE4Editor-BaconMan-4523.dll!ABM_EnemyPawn::TakeDamage() (0x00007ffe577ff1e7) + 0 bytes [c:\users\jon\svn\bacon man ue4\source\baconman\private\bm_enemypawn.cpp:102]
UE4Editor-Engine.dll!UnknownFunction (0x00007ffe5b84603c) + 0 bytes [UnknownFile:0]
UE4Editor-Engine.dll!UnknownFunction (0x00007ffe5b5e5aa5) + 0 bytes [UnknownFile:0]
UE4Editor-CoreUObject.dll!UnknownFunction (0x00007ffe6e786394) + 0 bytes [UnknownFile:0]
UE4Editor-CoreUObject.dll!UnknownFunction (0x00007ffe6e841f5e) + 0 bytes [UnknownFile:0]
UE4Editor-CoreUObject.dll!UnknownFunction (0x00007ffe6e85e7a2) + 0 bytes [UnknownFile:0]
UE4Editor-CoreUObject.dll!UnknownFunction (0x00007ffe6e85fbce) + 0 bytes [UnknownFile:0]
UE4Editor-CoreUObject.dll!UnknownFunction (0x00007ffe6e84247a) + 0 bytes [UnknownFile:0]
UE4Editor-CoreUObject.dll!UnknownFunction (0x00007ffe6e881254) + 0 bytes [UnknownFile:0]
UE4Editor-CoreUObject.dll!UnknownFunction (0x00007ffe6e85fbce) + 0 bytes [UnknownFile:0]
UE4Editor-CoreUObject.dll!UnknownFunction (0x00007ffe6e786394) + 0 bytes [UnknownFile:0]
UE4Editor-CoreUObject.dll!UnknownFunction (0x00007ffe6e85f3c3) + 0 bytes [UnknownFile:0]
UE4Editor-Engine.dll!UnknownFunction (0x00007ffe5b69be51) + 0 bytes [UnknownFile:0]
UE4Editor-Engine.dll!UnknownFunction (0x00007ffe5b61d758) + 0 bytes [UnknownFile:0]
UE4Editor-Engine.dll!UnknownFunction (0x00007ffe5b673d88) + 0 bytes [UnknownFile:0]
UE4Editor-Engine.dll!UnknownFunction (0x00007ffe5b66a74d) + 0 bytes [UnknownFile:0]
UE4Editor-Engine.dll!UnknownFunction (0x00007ffe5badec88) + 0 bytes [UnknownFile:0]
UE4Editor-Engine.dll!UnknownFunction (0x00007ffe5baf8326) + 0 bytes [UnknownFile:0]
UE4Editor-Engine.dll!UnknownFunction (0x00007ffe5ba9d76b) + 0 bytes [UnknownFile:0]
UE4Editor-Engine.dll!UnknownFunction (0x00007ffe5bb6484d) + 0 bytes [UnknownFile:0]
UE4Editor-Engine.dll!UnknownFunction (0x00007ffe5b664217) + 0 bytes [UnknownFile:0]
UE4Editor-Engine.dll!UnknownFunction (0x00007ffe5b673376) + 0 bytes [UnknownFile:0]
UE4Editor-Engine.dll!UnknownFunction (0x00007ffe5bd3f8b6) + 0 bytes [UnknownFile:0]
UE4Editor-Engine.dll!UnknownFunction (0x00007ffe5bd4badb) + 0 bytes [UnknownFile:0]
UE4Editor-Core.dll!UnknownFunction (0x00007ffe6c536514) + 0 bytes [UnknownFile:0]
UE4Editor-Core.dll!UnknownFunction (0x00007ffe6c53669d) + 0 bytes [UnknownFile:0]
UE4Editor-Core.dll!UnknownFunction (0x00007ffe6c5547c5) + 0 bytes [UnknownFile:0]
UE4Editor-Engine.dll!UnknownFunction (0x00007ffe5bd840c5) + 0 bytes [UnknownFile:0]
UE4Editor-Engine.dll!UnknownFunction (0x00007ffe5bd6e599) + 0 bytes [UnknownFile:0]
UE4Editor-Engine.dll!UnknownFunction (0x00007ffe5bd71005) + 0 bytes [UnknownFile:0]
UE4Editor-Engine.dll!UnknownFunction (0x00007ffe5ba34d96) + 0 bytes [UnknownFile:0]
UE4Editor-Engine.dll!UnknownFunction (0x00007ffe5ba3bdcf) + 0 bytes [UnknownFile:0]
UE4Editor-Engine.dll!UnknownFunction (0x00007ffe5b897753) + 0 bytes [UnknownFile:0]
UE4Editor.exe!FEngineLoop::Tick() (0x00007ff7d22ca8f4) + 0 bytes [d:\buildfarm\buildmachine_++depot+ue4-releases+4.5\engine\source\runtime\launch\private\launchengineloop.cpp:2129]
UE4Editor.exe!GuardedMain() (0x00007ff7d22bf9df) + 0 bytes [d:\buildfarm\buildmachine_++depot+ue4-releases+4.5\engine\source\runtime\launch\private\launch.cpp:133]
UE4Editor.exe!GuardedMainWrapper() (0x00007ff7d22bfa4a) + 5 bytes [d:\buildfarm\buildmachine_++depot+ue4-releases+4.5\engine\source\runtime\launch\private\windows\launchwindows.cpp:125]
UE4Editor.exe!WinMain() (0x00007ff7d22cbf19) + 17 bytes [d:\buildfarm\buildmachine_++depot+ue4-releases+4.5\engine\source\runtime\launch\private\windows\launchwindows.cpp:201]
UE4Editor.exe!__tmainCRTStartup() (0x00007ff7d22ccdc9) + 21 bytes [f:\dd\vctools\crt\crtw32\dllstuff\crtexe.c:618]
KERNEL32.DLL!UnknownFunction (0x00007ffe831016ad) + 0 bytes [UnknownFile:0]
ntdll.dll!UnknownFunction (0x00007ffe83f94409) + 0 bytes [UnknownFile:0]
ntdll.dll!UnknownFunction (0x00007ffe83f94409) + 0 bytes [UnknownFile:0]


[2014.11.29-18.08.40:437][234]LogExit: Executing StaticShutdownAfterError
[2014.11.29-18.08.40:447][234]LogOutputDevice:Warning: 

Script Stack:
ProjectileBase_C.ExecuteUbergraph_ProjectileBase
ProjectileBase_C.BndEvt__Projectile_K2Node_ComponentBoundEvent_0_ComponentHitSignature__DelegateSignature

[2014.11.29-18.08.40:465][234]LogWindows: FPlatformMisc::RequestExit(1)
[2014.11.29-18.08.40:465][234]Log file closed, 11/29/14 13:08:40

The same exact thing happened when trying to get the enemies based actor to bounce off. I was forced to do a trace instead.

My guess is that EventInstigator is NULL. You are checking if ->GetOwner returns NULL, but that won’t help if the EventInstigator is not valid.

I guess that’s true, I am comparing it to a projectile that gets destroyed as soon as it hits. So Maybe I’ll try to work around that.