Fixed profile viewing of other players throw null errors #377

This commit is contained in:
Chomp
2025-06-08 16:00:07 +01:00
parent bfc8f3df30
commit e1588f8c8b
2 changed files with 13 additions and 11 deletions
@@ -292,21 +292,21 @@ public class ProfileController(
itemsToReturn.AddRange(itemWithChildren);
}
return new GetOtherProfileResponse
var profile = new GetOtherProfileResponse
{
Id = profileToViewPmc.Id,
Aid = profileToViewPmc.Aid,
Info =
Info = new OtherProfileInfo
{
Nickname = profileToViewPmc.Info.Nickname,
Side = profileToViewPmc.Info.Side,
Experience = profileToViewPmc.Info.Experience,
MemberCategory = profileToViewPmc.Info.MemberCategory as int?,
MemberCategory = (int)(profileToViewPmc.Info.MemberCategory ?? MemberCategory.Default),
BannedState = profileToViewPmc.Info.BannedState,
BannedUntil = profileToViewPmc.Info.BannedUntil,
RegistrationDate = profileToViewPmc.Info.RegistrationDate
},
Customization =
Customization = new OtherProfileCustomization
{
Head = profileToViewPmc.Customization.Head,
Body = profileToViewPmc.Customization.Body,
@@ -315,24 +315,24 @@ public class ProfileController(
Dogtag = profileToViewPmc.Customization.DogTag
},
Skills = profileToViewPmc.Skills,
Equipment =
Equipment = new OtherProfileEquipment
{
Id = profileToViewPmc.Inventory.Equipment,
Items = profileToViewPmc.Inventory.Items
},
Achievements = profileToViewPmc.Achievements,
FavoriteItems = _profileHelper.GetOtherProfileFavorites(profileToViewPmc),
PmcStats =
PmcStats = new OtherProfileStats
{
Eft =
Eft = new OtherProfileSubStats
{
TotalInGameTime = profileToViewPmc.Stats.Eft.TotalInGameTime,
OverAllCounters = profileToViewPmc.Stats.Eft.OverallCounters
}
},
ScavStats =
ScavStats = new OtherProfileStats
{
Eft =
Eft = new OtherProfileSubStats
{
TotalInGameTime = profileToViewScav.Stats.Eft.TotalInGameTime,
OverAllCounters = profileToViewScav.Stats.Eft.OverallCounters
@@ -343,6 +343,8 @@ public class ProfileController(
HideoutAreaStashes = profileToViewPmc.Inventory.HideoutAreaStashes,
Items = itemsToReturn
};
return profile;
}
/// <summary>