Bad cast compiling in 4.14

Hello guys,

Trying to update my project. On top of errors with the server target no longer working I’m now getting an error with my “myplayercontroller”

My respawn function is giving an error cast from
Base to derived requires dynamic_cast or static_cast

This was not and error before 4.14

Cpp file:

#include “Gibball.h”
#include “MyPlayerController.h”
#include “MyPlayerState.h”

void AMyPlayerController::OnKilled()
{
UnPossess();
GetWorldTimerManager().SetTimer(TimerHandle_Respawn, this, &AMyPlayerController::Respawn, 5.f);
}

void AMyPlayerController::Respawn()
{
AGameMode * GameMode = GetWorld()->GetAuthGameMode();
if (GameMode)
{
APawn * NewPawn = GameMode->SpawnDefaultPawnFor(this, GameMode->ChoosePlayerStart(this));/ Possess(NewPawn);
}
}

void AMyPlayerController::OnResetJock()
{
UnPossess();
GetWorldTimerManager().SetTimer(TimerHandle_Resetplayer, this, &AMyPlayerController::Respawn, 0.5f);
}

Sorry for the bad formatting currently mobile.

AGameMode * GameMode = GetWorld()->GetAuthGameMode();

Is where the error is coming from.

Found my Solution

Was

  AGameMode * GameMode = GetWorld()->GetAuthGameMode();

Changed to

   AGameMode* GameMode = Cast<AGameMode>(GetWorld()->GetAuthGameMode());