Skip to content

Commit 478b9b3

Browse files
author
Chomp
committed
Moved repeatablesInProfile nullguard to early in function when it can be helpful + make it check for questToReplace property too
1 parent aa928ac commit 478b9b3

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

project/src/controllers/RepeatableQuestController.ts

+7-7
Original file line numberDiff line numberDiff line change
@@ -490,6 +490,13 @@ export class RepeatableQuestController {
490490
changeRequest.qid,
491491
pmcData,
492492
);
493+
if (!repeatablesInProfile || !questToReplace) {
494+
// Unable to find quest being replaced
495+
const message = this.localisationService.getText("quest-unable_to_find_repeatable_to_replace");
496+
this.logger.error(message);
497+
498+
return this.httpResponse.appendErrorToOutput(output, message);
499+
}
493500

494501
// Subtype name of quest - daily/weekly/scav
495502
const repeatableTypeLower = repeatablesInProfile.name.toLowerCase();
@@ -571,13 +578,6 @@ export class RepeatableQuestController {
571578

572579
// Clone data before we send it to client
573580
const repeatableToChangeClone = this.cloner.clone(repeatablesInProfile);
574-
if (!repeatableToChangeClone) {
575-
// Unable to find quest being replaced
576-
const message = this.localisationService.getText("quest-unable_to_find_repeatable_to_replace");
577-
this.logger.error(message);
578-
579-
return this.httpResponse.appendErrorToOutput(output, message);
580-
}
581581

582582
// Purge inactive repeatables
583583
repeatableToChangeClone.inactiveQuests = [];

0 commit comments

Comments
 (0)