From 35f82f50fa4969aee8f7385e4416aeddff7ba802 Mon Sep 17 00:00:00 2001 From: Dev Date: Fri, 8 Nov 2024 16:24:27 +0000 Subject: [PATCH] Fixed client error when accessing inventory during raid start as PMC --- .../MergeScavPmcQuestsOnInventoryLoadPatch.cs | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/project/SPT.Custom/Patches/MergeScavPmcQuestsOnInventoryLoadPatch.cs b/project/SPT.Custom/Patches/MergeScavPmcQuestsOnInventoryLoadPatch.cs index f0f04ce..7aa059b 100644 --- a/project/SPT.Custom/Patches/MergeScavPmcQuestsOnInventoryLoadPatch.cs +++ b/project/SPT.Custom/Patches/MergeScavPmcQuestsOnInventoryLoadPatch.cs @@ -26,15 +26,17 @@ namespace SPT.Custom.Patches public static void PatchPreFix(ref IEnumerable quests) { var gameWorld = Singleton.Instance; - if (gameWorld != null) + if (gameWorld?.MainPlayer?.Location != "hideout" + && gameWorld?.MainPlayer?.Fraction == ETagStatus.Scav) { - if (gameWorld.MainPlayer?.Location != "hideout" && gameWorld.MainPlayer?.Fraction == ETagStatus.Scav) - { - var pmcQuests = PatchConstants.BackEndSession.Profile.QuestsData; - var scavQuests = PatchConstants.BackEndSession.ProfileOfPet.QuestsData; - quests = pmcQuests.Concat(scavQuests); - } - } + var pmcQuests = PatchConstants.BackEndSession.Profile?.QuestsData; + var scavQuests = PatchConstants.BackEndSession.ProfileOfPet?.QuestsData; + if (pmcQuests != null && scavQuests != null) + { + quests = pmcQuests.Concat(scavQuests); + } + + } } } } \ No newline at end of file