Problem with Interface

The game I’m developing is Pacman.
i control pacman and 2 ghosts move to eat it.
This is what I would like to do in the IGhostInterface.cpp class:

FVector IGhostInterface::SelectWay(FVector2D PosizioneGhost){
AMyGameMode* GameMode = Cast<AMyGameMode>(this);
FVector UpSpazio = GameMode->GMaze->GetRelativeLocationByXYPosition(PosizioneGhost);
GameMode->PositionPacmanGrid=UpSpazio;
}

Return null pointer.

I tried to insert the data I need inside an AActor class (Maze) but even then I get a null pointer.

AMaze* Maze= Cast<AMaze>(this);
FVector UpSpazio = Maze->GetRelativeLocationByXYPosition(PosizioneGhost);
Maze->PositionPacmanGrid=UpSpazio;

In the IGhostInterface I should both access functions and data.