Safely exit returnPlayerOffer() when no profile is found

This commit is contained in:
Dev 2024-07-18 09:18:33 +01:00
parent bd5e7b1e62
commit af6d138f3c

View File

@ -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)