diff --git a/web/src/stores/budget-account.ts b/web/src/stores/budget-account.ts index 1de29ba..becea06 100644 --- a/web/src/stores/budget-account.ts +++ b/web/src/stores/budget-account.ts @@ -61,8 +61,15 @@ export const useAccountStore = defineStore("budget/account", { }, GetIncomeAvailable(state) { return (year: number, month: number) => { + const IncomeCategoryID = this.GetIncomeCategoryID; + if(IncomeCategoryID == null) + return 0; + const categories = this.AllCategoriesForMonth(year, month); - return categories.filter(x => x.ID == this.GetIncomeCategoryID)[0].AvailableLastMonth; + const category = categories.filter(x => x.ID == IncomeCategoryID)[0]; + if (category == null) + return 0; + return category.AvailableLastMonth; } }, CategoryGroupsForMonth(state) {