I used this condition but it returns true and the crash happens again
here is the edited code:
for (auto Result : SearchSettings->SearchResults)
{
FString Id = Result.GetSessionIdStr();
FString User = Result.Session.OwningUserName;
FString MatchType;
Result.Session.SessionSettings.Get(FName("MatchType"),MatchType);
if(MatchType == FString("FreeForAll"))
{
if(!Result.IsSessionInfoValid())
return;
if (GEngine)
{
GEngine->AddOnScreenDebugMessage(
-1,
15.f,
FColor::Cyan,
FString::Printf(TEXT("Joining Match Type: %s ..."), *MatchType)
);
}
OnlineSessionInterface->AddOnJoinSessionCompleteDelegate_Handle(OnSessionJoinedDelegate);
auto NetId = GetPlayerState()->GetUniqueId();
OnlineSessionInterface->JoinSession(*NetId, NAME_GameSession, Result); //Game crashes
}
if(GEngine)
{
GEngine->AddOnScreenDebugMessage(
-1,
15.f,
FColor::Blue,
FString::Printf(TEXT("ID: %s | Owner: %s"),*Id,*User)
);
}
}