From 11384c9b3fa3bd00b18ca4a0707b13d7374c6ad7 Mon Sep 17 00:00:00 2001 From: Archangel Date: Tue, 5 Aug 2025 14:28:03 +0200 Subject: [PATCH] Fix null checks for profile --- .../SPTarkov.Server.Core/Controllers/HideoutController.cs | 2 +- .../SPTarkov.Server.Core/Controllers/RagfairController.cs | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Libraries/SPTarkov.Server.Core/Controllers/HideoutController.cs b/Libraries/SPTarkov.Server.Core/Controllers/HideoutController.cs index f0df6ac1..f6416bc5 100644 --- a/Libraries/SPTarkov.Server.Core/Controllers/HideoutController.cs +++ b/Libraries/SPTarkov.Server.Core/Controllers/HideoutController.cs @@ -1515,7 +1515,7 @@ public class HideoutController( foreach (var (sessionId, profile) in saveServer.GetProfiles()) { if ( - profile.CharacterData.PmcData.Hideout is not null + profile.CharacterData?.PmcData?.Hideout is not null && profileActivityService.ActiveWithinLastMinutes(sessionId, _hideoutConfig.UpdateProfileHideoutWhenActiveWithinMinutes) ) { diff --git a/Libraries/SPTarkov.Server.Core/Controllers/RagfairController.cs b/Libraries/SPTarkov.Server.Core/Controllers/RagfairController.cs index 64d087b2..98517c2f 100644 --- a/Libraries/SPTarkov.Server.Core/Controllers/RagfairController.cs +++ b/Libraries/SPTarkov.Server.Core/Controllers/RagfairController.cs @@ -59,10 +59,10 @@ public class RagfairController( foreach (var (sessionId, profile) in profileHelper.GetProfiles()) { // Check profile is capable of creating offers - var pmcProfile = profile.CharacterData.PmcData; + var pmcProfile = profile?.CharacterData?.PmcData; if ( - pmcProfile.RagfairInfo is not null - && pmcProfile.Info.Level >= databaseService.GetGlobals().Configuration.RagFair.MinUserLevel + pmcProfile?.RagfairInfo is not null + && pmcProfile?.Info?.Level >= databaseService.GetGlobals().Configuration.RagFair.MinUserLevel ) { ragfairOfferHelper.ProcessOffersOnProfile(sessionId);