Improve processFailedQuests() handling of null parameter

This commit is contained in:
Dev 2023-08-03 08:38:36 +01:00
parent 2c7973d8d9
commit 0c37a76ff6

View File

@ -176,11 +176,17 @@ export class InRaidHelper
*/ */
protected processFailedQuests(sessionId: string, pmcData: IPmcData, preRaidQuests: Quest[], postRaidQuests: Quest[]): void protected processFailedQuests(sessionId: string, pmcData: IPmcData, preRaidQuests: Quest[], postRaidQuests: Quest[]): void
{ {
if (!preRaidQuests)
{
// No quests to compare against, skip
return;
}
// Loop over all quests from post-raid profile // Loop over all quests from post-raid profile
for (const postRaidQuest of postRaidQuests) for (const postRaidQuest of postRaidQuests)
{ {
// Find matching pre-raid quest // Find matching pre-raid quest
const preRaidQuest = preRaidQuests.find(x => x.qid === postRaidQuest.qid); const preRaidQuest = preRaidQuests?.find(x => x.qid === postRaidQuest.qid);
if (preRaidQuest) if (preRaidQuest)
{ {
// Post-raid quest is failed but wasn't pre-raid // Post-raid quest is failed but wasn't pre-raid