From 281cba8db5c5eee579a0587fe6679b3b414c88d8 Mon Sep 17 00:00:00 2001 From: Dev Date: Fri, 4 Aug 2023 08:49:22 +0100 Subject: [PATCH] Prevent randomiseItemUpdProperties() running if the item being randomised has a db item with no _props data --- project/src/services/FenceService.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/project/src/services/FenceService.ts b/project/src/services/FenceService.ts index 78997d42..0d0a1c2f 100644 --- a/project/src/services/FenceService.ts +++ b/project/src/services/FenceService.ts @@ -546,6 +546,13 @@ export class FenceService */ protected randomiseItemUpdProperties(itemDetails: ITemplateItem, itemToAdjust: Item): void { + if (!itemDetails._props) + { + this.logger.error(`Item ${itemDetails._name} lacks a _props field, unable to randomise item: ${itemToAdjust._id}`); + + return; + } + // Randomise hp resource of med items if ("MaxHpResource" in itemDetails._props && itemDetails._props.MaxHpResource > 0) {