From 6d08f7f8c91b31e27ff44162b7837751405ec67d Mon Sep 17 00:00:00 2001 From: mat Date: Sat, 9 Apr 2022 19:38:54 -0500 Subject: oops lol i broke everything --- src/cleaners/skyblock/bank.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/cleaners/skyblock/bank.ts') diff --git a/src/cleaners/skyblock/bank.ts b/src/cleaners/skyblock/bank.ts index ac46867..50770e7 100644 --- a/src/cleaners/skyblock/bank.ts +++ b/src/cleaners/skyblock/bank.ts @@ -15,6 +15,12 @@ export interface BankHistoryItem { export function cleanBank(data: typedHypixelApi.SkyBlockProfile): Bank { let history: BankHistoryItem[] = [] + if (!(data?.banking && 'transactions' in data?.banking)) { + return { + history: [], + balance: undefined + } + } if (data?.banking?.transactions) { let bankBalance = Math.round(data.banking.balance * 10) / 10 @@ -35,7 +41,7 @@ export function cleanBank(data: typedHypixelApi.SkyBlockProfile): Bank { // history.reverse() return { - balance: data?.banking?.balance ? Math.round(data.banking.balance * 10) / 10 : undefined, + balance: (data?.banking && 'balance' in data.banking && data.banking.balance) ? Math.round(data.banking.balance * 10) / 10 : undefined, history } } \ No newline at end of file -- cgit