From 488b9f5f1a7b994a600329532fafc56e1dee83d7 Mon Sep 17 00:00:00 2001 From: Dev Date: Sun, 18 Jun 2023 15:39:20 +0100 Subject: [PATCH] prevent null ConflictingItems from causing isItemIncompatibleWithCurrentItems() to error --- project/src/helpers/BotGeneratorHelper.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/project/src/helpers/BotGeneratorHelper.ts b/project/src/helpers/BotGeneratorHelper.ts index 46029f50..54c940f5 100644 --- a/project/src/helpers/BotGeneratorHelper.ts +++ b/project/src/helpers/BotGeneratorHelper.ts @@ -246,7 +246,7 @@ export class BotGeneratorHelper } // Check if any of the current inventory templates have the incoming item defined as incompatible - blockingItem = equippedItems.find(x => x._props.ConflictingItems.includes(tplToCheck)); + blockingItem = equippedItems.find(x => x._props.ConflictingItems?.includes(tplToCheck)); if (blockingItem) { //this.logger.warning(`2 incompatibility found between - ${itemToEquip[1]._name} and ${blockingItem._props.Name} - ${equipmentSlot}`); @@ -254,7 +254,7 @@ export class BotGeneratorHelper } // Check if the incoming item has any inventory items defined as incompatible - const blockingInventoryItem = items.find(x => itemToEquip[1]._props[`Blocks${x.slotId}`] || itemToEquip[1]._props.ConflictingItems.includes(x._tpl)); + const blockingInventoryItem = items.find(x => itemToEquip[1]._props[`Blocks${x.slotId}`] || itemToEquip[1]._props.ConflictingItems?.includes(x._tpl)); if (blockingInventoryItem) { //this.logger.warning(`3 incompatibility found between - ${itemToEquip[1]._name} and ${blockingInventoryItem._tpl} - ${equipmentSlot}`)