r17271 - gnucash/branches/2.2/src/report/report-system - [r17178, r17179] Reporting: Prevent GnuCash from crashing if a report's option generating procedure causes a Scheme exception. Also fix a typo of "names" vs. "namer".

Christian Stimming cstim at cvs.gnucash.org
Mon Jul 7 16:55:28 EDT 2008


Author: cstim
Date: 2008-07-07 16:55:28 -0400 (Mon, 07 Jul 2008)
New Revision: 17271
Trac: http://svn.gnucash.org/trac/changeset/17271

Modified:
   gnucash/branches/2.2/src/report/report-system/report.scm
Log:
[r17178, r17179] Reporting: Prevent GnuCash from crashing if a report's option generating procedure causes a Scheme exception. Also fix a typo of "names" vs. "namer".

Originally by cedayiv.


Modified: gnucash/branches/2.2/src/report/report-system/report.scm
===================================================================
--- gnucash/branches/2.2/src/report/report-system/report.scm	2008-07-07 20:55:18 UTC (rev 17270)
+++ gnucash/branches/2.2/src/report/report-system/report.scm	2008-07-07 20:55:28 UTC (rev 17271)
@@ -183,13 +183,19 @@
            (gnc:get-html-style-sheets)))))
 
     (if (procedure? generator)
-        (let ((options (generator)))
+        (let ((options (gnc:backtrace-if-exception generator)))
+          (if (not options)
+              (begin
+                (gnc:warn "BUG DETECTED: Scheme exception raised in "
+                          "report options generator procedure named "
+                          (procedure-name generator))
+                (set! options (gnc:new-options))))
           (gnc:register-option options stylesheet)
           (gnc:register-option options namer)
           options)
         (let ((options (gnc:new-options)))
           (gnc:register-option options stylesheet)
-          (gnc:register-option options names)
+          (gnc:register-option options namer)
           options))))
 
 ;; A <report> represents an instantiation of a particular report type.



More information about the gnucash-changes mailing list