gnucash maint: Bug 765846 - Expense Over Time for subaccounts: An error occurred while running the report

Geert Janssens gjanssens at code.gnucash.org
Sun Mar 4 10:33:56 EST 2018


Updated	 via  https://github.com/Gnucash/gnucash/commit/51e25112 (commit)
	from  https://github.com/Gnucash/gnucash/commit/18f0d053 (commit)



commit 51e2511223eb0873f342f0153929ef53d849d0eb
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Sun Mar 4 19:16:39 2018 +0800

    Bug 765846 - Expense Over Time for subaccounts: An error occurred while running the report
    
    fix crash if acc-depth too low

diff --git a/src/report/standard-reports/category-barchart.scm b/src/report/standard-reports/category-barchart.scm
index 45f7f92..c6396f4 100644
--- a/src/report/standard-reports/category-barchart.scm
+++ b/src/report/standard-reports/category-barchart.scm
@@ -264,15 +264,25 @@ developing over time"))
     (define (show-acct? a)
       (member a accounts))
 
+    (define tree-depth (if (equal? account-levels 'all)
+                           (gnc:get-current-account-tree-depth)
+                           account-levels))
+
+    (define the-acount-destination-alist
+      (account-destination-alist accounts account-types tree-depth))
+
     ;;(gnc:debug accounts)
     (if (not (null? accounts))
-        
+
+        (if (null? the-acount-destination-alist)
+            (gnc:html-document-add-object!
+             document
+             (gnc:html-make-empty-data-warning
+              report-title (gnc:report-id report-obj)))
+
         ;; Define more helper variables.
         (let* ((commodity-list #f)
                (exchange-fn #f)
-               (tree-depth (if (equal? account-levels 'all)
-                               (gnc:get-current-account-tree-depth)
-                               account-levels))
                (averaging-fraction-func (gnc:date-get-fraction-func averaging-selection))
                (interval-fraction-func (gnc:date-get-fraction-func interval))
                (averaging-multiplier
@@ -368,10 +378,7 @@ developing over time"))
 	  (define (apply-sign account x)
 	    (if (reverse-balance? account) (- x) x))
           (define (calculate-report accounts progress-range)
-	    (let* ((the-acount-destination-alist (account-destination-alist accounts
-									    account-types
-									    tree-depth))
-		   (account-reformat
+	    (let* ((account-reformat
 		    (if do-intervals?
 			(lambda (account result)
 			  (map (lambda (collector datepair)
@@ -644,7 +651,7 @@ developing over time"))
            (gnc:html-document-add-object!
             document
             (gnc:html-make-empty-data-warning
-	     report-title (gnc:report-id report-obj)))))
+	     report-title (gnc:report-id report-obj))))))
         
 	;; else if no accounts selected
         (gnc:html-document-add-object! 



Summary of changes:
 src/report/standard-reports/category-barchart.scm | 25 +++++++++++++++--------
 1 file changed, 16 insertions(+), 9 deletions(-)



More information about the gnucash-changes mailing list