hello when i create a session in unreal engine i get access violation when creating a session
i got this error
exception: exception 0xc0000005 encountered at address 0x7ffb5c80137d: access violation reading location 0x00000311 unreal engine
and here is my code snipt
void AMenuSystemCharacter::CreateGameSession()
{
// Called when pressing the 1 key
if (!OnlineSessionInterface.IsValid())
{
return;
}
auto ExistingSession = OnlineSessionInterface->GetNamedSession(NAME_GameSession);
if (ExistingSession != nullptr)
{
OnlineSessionInterface->DestroySession(NAME_GameSession);
}
OnlineSessionInterface->AddOnCreateSessionCompleteDelegate_Handle(CreateSessionCompleteDelegate);
TSharedPtr<FOnlineSessionSettings> SessionSettings = MakeShareable(new FOnlineSessionSettings());
SessionSettings->bIsLANMatch = false;
SessionSettings->NumPublicConnections = 4;
SessionSettings->bAllowJoinInProgress = true;
SessionSettings->bAllowJoinViaPresence = true;
SessionSettings->bShouldAdvertise = true;
SessionSettings->bUsesPresence = true;
const ULocalPlayer* LocalPlayer = GetWorld()->GetFirstLocalPlayerFromController();
OnlineSessionInterface->CreateSession(*LocalPlayer->GetPreferredUniqueNetId(), NAME_GameSession, *SessionSettings);
}
void AMenuSystemCharacter::OnCreateSessionComplete(FName SessionName, bool bWasSuccessful)
{
if (bWasSuccessful)
{
if (GEngine)
{
GEngine->AddOnScreenDebugMessage(-1,20.f,FColor::Blue,FString::Printf(TEXT(“Create a session the session name is %s”),*SessionName.ToString()));
}
}
else
{
if (GEngine)
{
GEngine->AddOnScreenDebugMessage(-1,20.f,FColor::Red,FString(TEXT("Failed Create a session the session name is ")));
}
}
}
i checked every thing there no nullptr around just getting the violation address