mirror of
https://github.com/mordentral/AdvancedSessionsPlugin.git
synced 2025-10-22 16:04:18 +00:00
safety check
This commit is contained in:
@@ -247,18 +247,17 @@ void UAdvancedFriendsLibrary::GetStoredFriendsList(APlayerController *PlayerCont
|
|||||||
|
|
||||||
|
|
||||||
TArray< TSharedRef<FOnlineFriend> > FriendList;
|
TArray< TSharedRef<FOnlineFriend> > FriendList;
|
||||||
FriendsInterface->GetFriendsList(Player->GetControllerId(), EFriendsLists::ToString((EFriendsLists::Default)), FriendList);
|
if (FriendsInterface->GetFriendsList(Player->GetControllerId(), EFriendsLists::ToString((EFriendsLists::Default)), FriendList))
|
||||||
|
{
|
||||||
for (int32 i = 0; i < FriendList.Num(); i++)
|
for (int32 i = 0; i < FriendList.Num(); i++)
|
||||||
{
|
{
|
||||||
TSharedRef<FOnlineFriend> Friend = FriendList[i];
|
|
||||||
FBPFriendInfo BPF;
|
FBPFriendInfo BPF;
|
||||||
FOnlineUserPresence pres = Friend->GetPresence();
|
FOnlineUserPresence pres = FriendList[i]->GetPresence();
|
||||||
|
|
||||||
BPF.OnlineState = ((EBPOnlinePresenceState)((int32)pres.Status.State));
|
BPF.OnlineState = ((EBPOnlinePresenceState)((int32)pres.Status.State));
|
||||||
BPF.DisplayName = Friend->GetDisplayName();
|
BPF.DisplayName = FriendList[i]->GetDisplayName();
|
||||||
BPF.RealName = Friend->GetRealName();
|
BPF.RealName = FriendList[i]->GetRealName();
|
||||||
BPF.UniqueNetId.SetUniqueNetId(Friend->GetUserId());
|
BPF.UniqueNetId.SetUniqueNetId(FriendList[i]->GetUserId());
|
||||||
BPF.bIsPlayingSameGame = pres.bIsPlayingThisGame;
|
BPF.bIsPlayingSameGame = pres.bIsPlayingThisGame;
|
||||||
|
|
||||||
BPF.PresenceInfo.bIsOnline = pres.bIsOnline;
|
BPF.PresenceInfo.bIsOnline = pres.bIsOnline;
|
||||||
@@ -271,4 +270,10 @@ void UAdvancedFriendsLibrary::GetStoredFriendsList(APlayerController *PlayerCont
|
|||||||
|
|
||||||
FriendsList.Add(BPF);
|
FriendsList.Add(BPF);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
UE_LOG(AdvancedFriendsLog, Warning, TEXT("GetFriendsList Failed to get any friends!"));
|
||||||
|
return;
|
||||||
}
|
}
|
@@ -76,17 +76,16 @@ void UGetFriendsCallbackProxy::OnReadFriendsListCompleted(int32 LocalUserNum, bo
|
|||||||
|
|
||||||
TArray<FBPFriendInfo> FriendsListOut;
|
TArray<FBPFriendInfo> FriendsListOut;
|
||||||
TArray< TSharedRef<FOnlineFriend> > FriendList;
|
TArray< TSharedRef<FOnlineFriend> > FriendList;
|
||||||
Friends->GetFriendsList(LocalUserNum, ListName, FriendList);
|
if (Friends->GetFriendsList(LocalUserNum, ListName, FriendList))
|
||||||
|
{
|
||||||
for (int32 i = 0; i < FriendList.Num(); i++)
|
for (int32 i = 0; i < FriendList.Num(); i++)
|
||||||
{
|
{
|
||||||
TSharedRef<FOnlineFriend> Friend = FriendList[i];
|
|
||||||
FBPFriendInfo BPF;
|
FBPFriendInfo BPF;
|
||||||
FOnlineUserPresence pres = Friend->GetPresence();
|
FOnlineUserPresence pres = FriendList[i]->GetPresence();
|
||||||
BPF.OnlineState = ((EBPOnlinePresenceState)((int32)pres.Status.State));
|
BPF.OnlineState = ((EBPOnlinePresenceState)((int32)pres.Status.State));
|
||||||
BPF.DisplayName = Friend->GetDisplayName();
|
BPF.DisplayName = FriendList[i]->GetDisplayName();
|
||||||
BPF.RealName = Friend->GetRealName();
|
BPF.RealName = FriendList[i]->GetRealName();
|
||||||
BPF.UniqueNetId.SetUniqueNetId(Friend->GetUserId());
|
BPF.UniqueNetId.SetUniqueNetId(FriendList[i]->GetUserId());
|
||||||
BPF.bIsPlayingSameGame = pres.bIsPlayingThisGame;
|
BPF.bIsPlayingSameGame = pres.bIsPlayingThisGame;
|
||||||
|
|
||||||
BPF.PresenceInfo.bIsOnline = pres.bIsOnline;
|
BPF.PresenceInfo.bIsOnline = pres.bIsOnline;
|
||||||
@@ -100,6 +99,7 @@ void UGetFriendsCallbackProxy::OnReadFriendsListCompleted(int32 LocalUserNum, bo
|
|||||||
|
|
||||||
FriendsListOut.Add(BPF);
|
FriendsListOut.Add(BPF);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
OnSuccess.Broadcast(FriendsListOut);
|
OnSuccess.Broadcast(FriendsListOut);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user