improve robustness

This commit is contained in:
MaysWind
2024-12-12 08:54:19 +08:00
parent 563e328ce3
commit ee029294f1
2 changed files with 11 additions and 7 deletions
+1 -1
View File
@@ -243,7 +243,7 @@ export function getAllFilteredAccountsBalance(categorizedAccounts, accountFilter
isLiability: account.isLiability,
currency: account.currency
});
} else if (account.type === accountConstants.allAccountTypes.MultiSubAccounts) {
} else if (account.type === accountConstants.allAccountTypes.MultiSubAccounts && account.subAccounts) {
for (let subAccountIdx = 0; subAccountIdx < account.subAccounts.length; subAccountIdx++) {
const subAccount = account.subAccounts[subAccountIdx];
+10 -6
View File
@@ -188,9 +188,11 @@ export const useAccountsStore = defineStore('accounts', {
if (account.type === accountConstants.allAccountTypes.SingleAccount) {
allAccounts.push(account);
} else if (account.type === accountConstants.allAccountTypes.MultiSubAccounts) {
for (let j = 0; j < account.subAccounts.length; j++) {
const subAccount = account.subAccounts[j];
allAccounts.push(subAccount);
if (account.subAccounts) {
for (let j = 0; j < account.subAccounts.length; j++) {
const subAccount = account.subAccounts[j];
allAccounts.push(subAccount);
}
}
}
}
@@ -210,9 +212,11 @@ export const useAccountsStore = defineStore('accounts', {
if (account.type === accountConstants.allAccountTypes.SingleAccount) {
allVisibleAccounts.push(account);
} else if (account.type === accountConstants.allAccountTypes.MultiSubAccounts) {
for (let j = 0; j < account.subAccounts.length; j++) {
const subAccount = account.subAccounts[j];
allVisibleAccounts.push(subAccount);
if (account.subAccounts) {
for (let j = 0; j < account.subAccounts.length; j++) {
const subAccount = account.subAccounts[j];
allVisibleAccounts.push(subAccount);
}
}
}
}