From 41d491dd169cc5a40a91711248a30e0a6f19d723 Mon Sep 17 00:00:00 2001 From: Dev Date: Sun, 14 Jan 2024 10:27:26 +0000 Subject: [PATCH] Show error when quest not found in db --- project/src/helpers/QuestHelper.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/project/src/helpers/QuestHelper.ts b/project/src/helpers/QuestHelper.ts index 5cfbb775..bbd99e8b 100644 --- a/project/src/helpers/QuestHelper.ts +++ b/project/src/helpers/QuestHelper.ts @@ -412,9 +412,14 @@ export class QuestHelper statusTimers: {}, }; - // Check if quest has a prereq to be placed in a 'pending' state + // Check if quest has a prereq to be placed in a 'pending' state, otherwise set status timers value const questDbData = this.getQuestFromDb(acceptedQuest.qid, pmcData); - const waitTime = questDbData.conditions.AvailableForStart.find((x) => x.availableAfter > 0); + if (!questDbData) + { + this.logger.error(`Quest: ${acceptedQuest.qid} of type: ${acceptedQuest.type} not found`); + } + + const waitTime = questDbData?.conditions.AvailableForStart.find((x) => x.availableAfter > 0); if (waitTime && acceptedQuest.type !== "repeatable") { // Quest should be put into 'pending' state