Added guard against nullref inside updateFenceAssorts() to protect against modded items

This commit is contained in:
Dev 2024-05-12 19:08:11 +01:00
parent 4b7682383c
commit 02e8b5051c

View File

@ -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 =>