Fix null reference in GetIncomeAvailable
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing

This commit is contained in:
Jan Bader 2022-03-05 20:48:36 +00:00
parent 67ef4745a0
commit 244333adbc

View File

@ -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) {