AUDIT: r16836 - gnucash/trunk/src - Prevent crashing when a report template disappears (#505921).
Andreas Köhler
andi5.py at gmx.net
Thu Feb 28 16:02:32 EST 2008
Hi Andrew,
Am Montag, den 07.01.2008, 13:45 -0800 schrieb Andrew Sackville-West:
> On Mon, Jan 07, 2008 at 09:01:28PM +0100, Christian Stimming wrote:
> > Am Montag, 7. Januar 2008 00:55 schrieb Andrew Sackville-West:
> > > Author: andrewsw
> > > Date: 2008-01-06 18:55:48 -0500 (Sun, 06 Jan 2008)
> > > New Revision: 16836
> > > Trac: http://svn.gnucash.org/trac/changeset/16836
> > >
> > > Modified:
> > > gnucash/trunk/src/app-utils/options.scm
> > > gnucash/trunk/src/report/report-system/report.scm
> > > Log:
> > > Prevent crashing when a report template disappears (#505921).
> > >
> > > If a report template is missing (renamed, moved, deleted, whatever)
> > > while the report is still open, then the app will crash while reading
> > > the books file. The options-generator will fail and cause subsequent
> > > attempts to access the options to fail and crash. A couple checks for
> > > the existence of options is all it takes. Also included a warning dialog.
> >
> > Wonderful! Great! Hooray!
> >
> > I've been waiting for an easy solution like this for the report-name issue
> > forever! andrewsw be praised for this great bug resolution!
>
> /me blushes.
>
> glad you like it.
>
> A
please tell me whether I can push the attachment, as r16836 did not
apply cleanly. Thanks.
-- andi5
-------------- next part --------------
commit d20ece301f13032a9a9f77b5817adc4a4d99886e
Author: Andreas K?hler <andi5.py at gmx.net>
Date: Thu Feb 28 21:56:08 2008 +0100
[r16836] Prevent crashing when a report template disappears (#505921).
If a report template is missing (renamed, moved, deleted, whatever)
while the report is still open, then the app will crash while reading
the books file. The options-generator will fail and cause subsequent
attempts to access the options to fail and crash. A couple checks for
the existence of options is all it takes. Also included a warning dialog.
diff --git a/src/app-utils/options.scm b/src/app-utils/options.scm
index 4b132fe..375411a 100644
--- a/src/app-utils/options.scm
+++ b/src/app-utils/options.scm
@@ -1464,7 +1464,9 @@
((options 'for-each-general) section-thunk option-thunk))
(define (gnc:lookup-option options section name)
- ((options 'lookup) section name))
+ (if options
+ ((options 'lookup) section name)
+ #f))
(define (gnc:generate-restore-forms options options-string)
((options 'generate-restore-forms) options-string))
diff --git a/src/report/report-system/report.scm b/src/report/report-system/report.scm
index 0dc7a73..889e969 100644
--- a/src/report/report-system/report.scm
+++ b/src/report/report-system/report.scm
@@ -282,15 +282,23 @@
;; This is the function that is called when saved reports are evaluated.
(define (gnc:restore-report id template-name options)
- (let ((r ((record-constructor <report>)
- template-name id options #t #t #f #f)))
- (gnc-report-add r))
+ (if options
+ (let ((r ((record-constructor <report>)
+ template-name id options #t #t #f #f)))
+ (gnc-report-add r))
+ (begin
+ (gnc-error-dialog '() (string-append "Report Failed! One of your previously opened reports has failed to open. The template on which it was based: " template-name ", was not found."))
+ #f))
)
;; dummy function to enable backwards compatibility with newer reports
(define (gnc:restore-report-by-guid id template-id template-name options)
- (gnc:restore-report id template-name options))
-
+ (if options
+ (gnc:restore-report id template-name options)
+ (begin
+ (gnc-error-dialog '() (string-append "Report Failed! One of your previously opened reports has failed to open. The template on which it was based: " template-name ", was not found."))
+ #f))
+ )
(define (gnc:make-report-options template-name)
(let ((template (hash-ref *gnc:_report-templates_* template-name)))
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Dies ist ein digital signierter Nachrichtenteil
Url : http://lists.gnucash.org/pipermail/gnucash-devel/attachments/20080228/d197e636/attachment.bin
More information about the gnucash-devel
mailing list