From 9c81df91d1a0fea578c7111317b946a577f20c66 Mon Sep 17 00:00:00 2001 From: Dev Date: Mon, 15 Apr 2024 09:06:11 +0100 Subject: [PATCH] Fixed `itemDelivery()` failing when trader lacks a `dialogue` object (incorrectly configured custom traders) --- project/src/controllers/InraidController.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/project/src/controllers/InraidController.ts b/project/src/controllers/InraidController.ts index 6f9be86f..71225ed6 100644 --- a/project/src/controllers/InraidController.ts +++ b/project/src/controllers/InraidController.ts @@ -661,6 +661,12 @@ export class InraidController const pmcData = serverProfile.characters.pmc; const dialogueTemplates = this.databaseServer.getTables().traders[traderId].dialogue; + if (!dialogueTemplates) + { + this.logger.error(`Unable to deliver items as trader ${traderId} has no "dialogue" data`); + + return; + } const messageId = this.randomUtil.getArrayValue(dialogueTemplates.itemsDelivered); const messageStoreTime = this.timeUtil.getHoursAsSeconds(this.traderConfig.fence.btrDeliveryExpireHours);