diff --git a/project/src/helpers/TraderHelper.ts b/project/src/helpers/TraderHelper.ts index 8555b9d0..c6d7bcf9 100644 --- a/project/src/helpers/TraderHelper.ts +++ b/project/src/helpers/TraderHelper.ts @@ -215,7 +215,16 @@ export class TraderHelper { */ public setTraderUnlockedState(traderId: string, status: boolean, sessionId: string): void { const pmcData = this.profileHelper.getPmcProfile(sessionId); - pmcData.TradersInfo[traderId].unlocked = status; + const profileTraderData = pmcData.TradersInfo[traderId]; + if (!profileTraderData) { + this.logger.error( + `Unable to set trader ${traderId} unlocked state to: ${status} as trader cannot be found in profile`, + ); + + return; + } + + profileTraderData.unlocked = status; } /**