Referencing destroyed objects crashes game

This does not solve the problem. For example, I just got a crash at the following line of code (which gets called every tick):


	if (currentEnemy != NULL && !currentEnemy->IsPendingKill())
	{
		float distanceToEnemy = FVector::Dist(currentEnemy->GetActorLocation(), GetActorLocation());  // CRASH HERE
                ...
                ...

It crashed because currentEnemy is NULL :confused: