From 1f90ae0bb0810ebe001131bfaf34c0e08b6485a0 Mon Sep 17 00:00:00 2001 From: Dev Date: Wed, 25 Oct 2023 18:13:33 +0100 Subject: [PATCH] Add undefined check to `updateProfileBaseStats()` --- project/src/helpers/InRaidHelper.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/project/src/helpers/InRaidHelper.ts b/project/src/helpers/InRaidHelper.ts index efad9b22..c2d7a707 100644 --- a/project/src/helpers/InRaidHelper.ts +++ b/project/src/helpers/InRaidHelper.ts @@ -151,6 +151,13 @@ export class InRaidHelper continue; } + const postRaidValue = saveProgressRequest.profile.BackendCounters[backendCounterKey]?.value; + if (typeof postRaidValue === "undefined") + { + // No value, skip + continue; + } + const matchingPreRaidCounter = profileData.BackendCounters[backendCounterKey]; if (!matchingPreRaidCounter) { @@ -159,9 +166,9 @@ export class InRaidHelper continue; } - if (matchingPreRaidCounter.value !== saveProgressRequest.profile.BackendCounters[backendCounterKey].value) + if (matchingPreRaidCounter.value !== postRaidValue) { - this.logger.error(`Backendcounter: ${backendCounterKey} value is different post raid, old: ${matchingPreRaidCounter.value} new: ${saveProgressRequest.profile.BackendCounters[backendCounterKey].value}`); + this.logger.error(`Backendcounter: ${backendCounterKey} value is different post raid, old: ${matchingPreRaidCounter.value} new: ${postRaidValue}`); } }