OnDestroyed.AddDynamic crash

I want to bind a method to OnDestroyed delegate from PlayerController:

GetPawn()->OnDestroyed.AddDynamic(this, &ASurvivorController::OnPawnDestroyed);

The same binding works inside the character. However, when I do this in the controller, the engine just crashes. What am I doing wrong?

Hi. Probably in place your trying to get pawn your pawn is null ! Check it with debugger or simple printing in log. If you trying to bind delegates with pawn and controller look at controller
virtual void Possess(APawn* aPawn) override; function. Override this function in your controller, and do all your stuff here like:

// .h
virtual void Possess(APawn* aPawn) override;

// .cpp
    void ASurvivorController::Possess(APawn* aPawn)
    {
    	Super::Possess(aPawn);
    
    	if (aPawn)
    	{
    		aPawn->OnDestroyed.AddDynamic(this,&ASurvivorController::OnPawnDestroyed);
    	}
    }