From af50cb78694385b7e1560b73706c8741ab8db5b6 Mon Sep 17 00:00:00 2001 From: Dev Date: Sat, 20 Jan 2024 20:37:41 +0000 Subject: [PATCH] FIx `getProfileTraderPurchase()` failing when trader doesnt exist in profile --- project/src/services/TraderPurchasePersisterService.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/project/src/services/TraderPurchasePersisterService.ts b/project/src/services/TraderPurchasePersisterService.ts index 5c4aaa1b..5ace2017 100644 --- a/project/src/services/TraderPurchasePersisterService.ts +++ b/project/src/services/TraderPurchasePersisterService.ts @@ -62,7 +62,13 @@ export class TraderPurchasePersisterService return null; } - return profile.traderPurchases[traderId][assortId]; + const traderPurchases = profile.traderPurchases[traderId]; + if (!traderPurchases) + { + return null; + } + + return traderPurchases[assortId]; } /**