From cdb0279bdb513bc8465d5338b7dc211f911685dc Mon Sep 17 00:00:00 2001 From: CamBurr Date: Sat, 24 Feb 2024 15:26:00 -0700 Subject: [PATCH] Further safety checks. --- src/mod.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/mod.ts b/src/mod.ts index 5d8ee8c..9093035 100644 --- a/src/mod.ts +++ b/src/mod.ts @@ -56,6 +56,8 @@ class Mod implements IPreAkiLoadMod, IPostAkiLoadMod const pmcData: IPmcData = profile.characters.pmc; // Get the PMC and Scav data const scavData: IPmcData = profile.characters.scav; + + if (!pmcData.Skills || !scavData.Skills) return; // If the PMC or Scav skills do not exist, return pmcData.Skills.Common.forEach((skill) => // Loop through all skills { @@ -111,6 +113,8 @@ class Mod implements IPreAkiLoadMod, IPostAkiLoadMod const pmcData: IPmcData = profile.characters.pmc; const scavData: IPmcData = profile.characters.scav; + if (!pmcData.Info || !scavData.Info) return; // If the PMC or Scav info does not exist, return + const maxExperience = Math.max(pmcData.Info.Experience, scavData.Info.Experience); // Get the max experience const maxLevel = Math.max(pmcData.Info.Level, scavData.Info.Level); // Get the max level