diff --git a/pkg/expenses.go b/pkg/expenses.go index 06360a5..b5d9423 100644 --- a/pkg/expenses.go +++ b/pkg/expenses.go @@ -158,8 +158,9 @@ func (page *expensesIndexPage) mustComputeExpensesTotalAmount(ctx context.Contex join currency using (currency_code) group by decimal_digits `, where), args...) - if err := row.Scan(&page.SumAmount, &page.SumTotal); err != nil { - panic(err) + if notFoundErrorOrPanic(row.Scan(&page.SumAmount, &page.SumTotal)) { + page.SumAmount = "0.0" + page.SumTotal = "0.0" } row = conn.QueryRow(ctx, fmt.Sprintf(` @@ -180,8 +181,8 @@ func (page *expensesIndexPage) mustComputeExpensesTotalAmount(ctx context.Contex group by decimal_digits `, where), args...) var taxes [][]string - if err := row.Scan(&taxes); err != nil { - panic(err) + if notFoundErrorOrPanic(row.Scan(&taxes)) { + // well, nothing to do } page.SumTaxes = make(map[string]string) for _, tax := range taxes {