Added nullguard to setTraderUnlockedState()
This commit is contained in:
parent
379bbe8993
commit
93127ff16a
@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user