From 0bb445b821662326bcac42aa0c561bfedc24616f Mon Sep 17 00:00:00 2001 From: Evgencheg <73418250+Evgencheg@users.noreply.github.com> Date: Mon, 14 Oct 2024 12:43:39 +0300 Subject: [PATCH] Update ClientPreferencesManager.cs (#270) --- .../Preferences/ClientPreferencesManager.cs | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/Content.Client/Preferences/ClientPreferencesManager.cs b/Content.Client/Preferences/ClientPreferencesManager.cs index ed0e9dc870..28e35525b2 100644 --- a/Content.Client/Preferences/ClientPreferencesManager.cs +++ b/Content.Client/Preferences/ClientPreferencesManager.cs @@ -75,14 +75,16 @@ public void UpdateCharacter(ICharacterProfile profile, int slot) var collection = IoCManager.Instance!; #if LPP_Sponsors // _LostParadise-Sponsors - var allowedMarkings = _sponsorsManager.TryGetInfo(out var sponsor) ? sponsor.AllowedMarkings : Array.Empty(); - if (sponsor != null) - { - var tier = sponsor.Tier > 5 ? 5 : sponsor.Tier; - allowedMarkings = allowedMarkings.Concat(Loc.GetString($"sponsor-markings-tier-{tier}").Split(";", StringSplitOptions.RemoveEmptyEntries)).ToArray(); - } - var session = _playerManager.LocalSession!; - profile.EnsureValid(session, collection, allowedMarkings); + var allowedMarkings = _sponsorsManager.TryGetInfo(out var sponsor) ? sponsor.AllowedMarkings : Array.Empty(); + if (allowedMarkings is null) // Somehow + allowedMarkings = Array.Empty(); + if (sponsor != null) + { + var tier = sponsor.Tier > 5 ? 5 : sponsor.Tier; + var sponsorMarkings = Loc.GetString($"sponsor-markings-tier-{tier}").Split(";", StringSplitOptions.RemoveEmptyEntries); + if (sponsorMarkings is not null && sponsorMarkings.Count > 0) + allowedMarkings = allowedMarkings.Concat(sponsorMarkings).ToArray(); + } #else profile.EnsureValid(_playerManager.LocalSession!, collection); #endif