gnucash maint: [register.scm] prevent crash on running report on empty book

Christopher Lam clam at code.gnucash.org
Fri Sep 11 06:52:54 EDT 2020


Updated	 via  https://github.com/Gnucash/gnucash/commit/35374158 (commit)
	from  https://github.com/Gnucash/gnucash/commit/c7b0aca4 (commit)



commit 3537415889ff87f24a971b149c6013af2b594027
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Fri Sep 11 18:43:34 2020 +0800

    [register.scm] prevent crash on running report on empty book

diff --git a/gnucash/report/reports/standard/register.scm b/gnucash/report/reports/standard/register.scm
index a65c9d763..156fe008a 100644
--- a/gnucash/report/reports/standard/register.scm
+++ b/gnucash/report/reports/standard/register.scm
@@ -573,7 +573,8 @@
                (work-done 0)
                (odd-row? #t))
 
-      (gnc:report-percent-done (* 100 (/ work-done work-to-do)))
+      (unless (zero? work-to-do)
+        (gnc:report-percent-done (* 100 (/ work-done work-to-do))))
 
       (cond
 
@@ -582,6 +583,7 @@
        ;; add debit/credit totals to the table
        ;; ----------------------------------
        ((null? splits)
+        (gnc:report-percent-done 100)
 
         (when reg-report-show-totals?
           (add-subtotal-row (G_ "Total Debits") leader table used-columns



Summary of changes:
 gnucash/report/reports/standard/register.scm | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)



More information about the gnucash-changes mailing list