From af6d138f3cfcfca742f8b38e5f66780c4c0970f2 Mon Sep 17 00:00:00 2001 From: Dev Date: Thu, 18 Jul 2024 09:18:33 +0100 Subject: [PATCH] Safely exit `returnPlayerOffer()` when no profile is found --- project/src/services/RagfairOfferService.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/project/src/services/RagfairOfferService.ts b/project/src/services/RagfairOfferService.ts index 7e749141..ed131ee6 100644 --- a/project/src/services/RagfairOfferService.ts +++ b/project/src/services/RagfairOfferService.ts @@ -256,6 +256,12 @@ export class RagfairOfferService { const pmcId = String(playerOffer.user.id); const profile = this.profileHelper.getProfileByPmcId(pmcId); + if (!profile) + { + this.logger.error(`Unable to return flea offer ${playerOffer._id} as the profile: ${pmcId} could not be found`); + + return; + } const offerinProfileIndex = profile.RagfairInfo.offers.findIndex((o) => o._id === playerOffer._id); if (offerinProfileIndex === -1)