Handled possible null ref

This commit is contained in:
Dev 2024-10-24 14:17:39 +01:00
parent 100d04cc67
commit c6b78dba1d

View File

@ -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];