From c6b78dba1d7f6b0251c736a2a713c9dc25532951 Mon Sep 17 00:00:00 2001 From: Dev Date: Thu, 24 Oct 2024 14:17:39 +0100 Subject: [PATCH] Handled possible null ref --- project/src/controllers/HealthController.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/project/src/controllers/HealthController.ts b/project/src/controllers/HealthController.ts index eb0ccac9..ce28605b 100644 --- a/project/src/controllers/HealthController.ts +++ b/project/src/controllers/HealthController.ts @@ -93,12 +93,12 @@ export class HealthController { const itemRemovesEffects = Object.keys(healingItemDbDetails[1]._props.effects_damage).length > 0; if (itemRemovesEffects) { // Check body parts effects against what the healing item can remove - const effectsOnBodyPart = Object.keys(bodyPartToHeal.Effects); - if (!effectsOnBodyPart) { + if (!bodyPartToHeal.Effects) { this.logger.warning(`Tried to remove effects from body part: ${request.part} without effects`); return output; } + const effectsOnBodyPart = Object.keys(bodyPartToHeal.Effects); for (const effectKey of effectsOnBodyPart) { const matchingEffectFromHealingItem = healItemEffectDetails[effectKey];