Fix null reference in GetIncomeAvailable
This commit is contained in:
parent
67ef4745a0
commit
244333adbc
@ -61,8 +61,15 @@ export const useAccountStore = defineStore("budget/account", {
|
|||||||
},
|
},
|
||||||
GetIncomeAvailable(state) {
|
GetIncomeAvailable(state) {
|
||||||
return (year: number, month: number) => {
|
return (year: number, month: number) => {
|
||||||
|
const IncomeCategoryID = this.GetIncomeCategoryID;
|
||||||
|
if(IncomeCategoryID == null)
|
||||||
|
return 0;
|
||||||
|
|
||||||
const categories = this.AllCategoriesForMonth(year, month);
|
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) {
|
CategoryGroupsForMonth(state) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user