Observe that after the second call the GetFriends() won't return the list of friends.
The bug is here in the FUserManagerEOS::AddFriend() function:
// Add this friend as a remote player if we haven't already (this will grab user info)
if (!UniqueNetIdToAttributeAccessMap.Contains(FriendNetId))
{
AddRemotePlayer(LocalUserNum, EpicAccountId, FriendRef);
}
The UniqueNetIdToAttributeAccessMap basically contains the cached information of friends which is populated during the first call to the ReadFriendsList().
During the second call, here we skip calling the AddRemotePlayer() function to avoid making unnecessary requests for obtainig the friends info which we already have in our cache.
However the problem is that we've forgotten to set the friend info using our cached values in the else block. The fix would be to move a piece of code from the FUserManagerEOS::ReadUserInfo() to here:
// Add this friend as a remote player if we haven't already (this will grab user info)
if (!UniqueNetIdToAttributeAccessMap.Contains(FriendNetId))
{
AddRemotePlayer(LocalUserNum, EpicAccountId, FriendRef);
}
else
{
// set user info from the cached info
IAttributeAccessInterfaceRef AttributeAccessRef = UniqueNetIdToAttributeAccessMap[FriendNetId];
FOnlineFriendEOSPtr FriendPtr = LocalUser.FriendsList->GetByNetId(FriendNetId);
FriendPtr->UpdateInternalAttributes(AttributeAccessRef->GetInternalAttributes());
}
Observe that after the second call the GetFriends() won't return the list of friends.
The bug is here in the
FUserManagerEOS::AddFriend()
function:The
UniqueNetIdToAttributeAccessMap
basically contains the cached information of friends which is populated during the first call to theReadFriendsList()
.During the second call, here we skip calling the
AddRemotePlayer()
function to avoid making unnecessary requests for obtainig the friends info which we already have in our cache.However the problem is that we've forgotten to set the friend info using our cached values in the else block. The fix would be to move a piece of code from the
FUserManagerEOS::ReadUserInfo()
to here: