DetachFromControllerPendingDestroy

Controller->PawnPendingDestroy(this)

In theory this line could null out the controller reference of the pawn maybe? Or maybe it did at some point in the past.

Hi there,
I stumbled upon this function in the engine, in Pawn.cpp:

void APawn::DetachFromControllerPendingDestroy()
{
	if ( Controller != nullptr && Controller->GetPawn() == this )
	{
		Controller->PawnPendingDestroy(this);
		if (Controller != nullptr)
		{
			Controller->UnPossess();
			Controller = nullptr;
		}
	}
}

Isn’t the second if (Controller != nullptr) redundant, or is it necessary ?
Maybe nobody cares though, idk :slight_smile: