From 02e8b5051c2858a32b946064331af3ab9c078650 Mon Sep 17 00:00:00 2001 From: Dev Date: Sun, 12 May 2024 19:08:11 +0100 Subject: [PATCH] Added guard against nullref inside `updateFenceAssorts()` to protect against modded items --- 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 e3d46214..9506b2f1 100644 --- a/project/src/services/FenceService.ts +++ b/project/src/services/FenceService.ts @@ -394,6 +394,13 @@ export class FenceService { // Find the root item const newRootItem = itemWithChildren.find(item => item.slotId === "hideout"); + if (!newRootItem) + { + const firstItem = itemWithChildren.find(x => x); + this.logger.error(`Unable to process fence assort as root item is missing, ${firstItem?._tpl}, skipping`); + + continue; + } // Find a matching root item with same tpl in existing assort const existingRootItem = existingFenceAssorts.items.find(item =>