From 609d4672b5c8af9243210c9d3b9132b7169049b5 Mon Sep 17 00:00:00 2001 From: Bruno Bernardino Date: Sat, 8 Jan 2022 09:23:25 +0000 Subject: [PATCH] Fix adding a completely new expense --- lib/data-utils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/data-utils.ts b/lib/data-utils.ts index 5e057d1..a851d38 100644 --- a/lib/data-utils.ts +++ b/lib/data-utils.ts @@ -397,7 +397,7 @@ export const saveExpense = async (expense: T.Expense) => { (_expense) => _expense.description === expense.description, ); - if (matchingExpense.budget) { + if (matchingExpense && matchingExpense.budget) { expense.budget = matchingExpense.budget; } }