r20550 - gnucash/branches/2.4/src/report/report-system - [20549] Bug #647316: Fix crash when deleting custom report if no backup file existed.

Christian Stimming cstim at code.gnucash.org
Sat Apr 9 17:34:42 EDT 2011


Author: cstim
Date: 2011-04-09 17:34:42 -0400 (Sat, 09 Apr 2011)
New Revision: 20550
Trac: http://svn.gnucash.org/trac/changeset/20550

Modified:
   gnucash/branches/2.4/src/report/report-system/report.scm
Log:
[20549] Bug #647316: Fix crash when deleting custom report if no backup file existed.

Before deleting the backup file by (delete-file), it must be checked
whether the to-be-deleted file exists, otherwise the guile procedure
will crash.

Modified: gnucash/branches/2.4/src/report/report-system/report.scm
===================================================================
--- gnucash/branches/2.4/src/report/report-system/report.scm	2011-04-09 21:34:13 UTC (rev 20549)
+++ gnucash/branches/2.4/src/report/report-system/report.scm	2011-04-09 21:34:42 UTC (rev 20550)
@@ -618,7 +618,8 @@
   (let ((temp-path (gnc-build-dotgnucash-path "saved-reports-2.4-backup")))
     (gnc:debug "saving all reports...")
     ;; On windows, it seems to crash if we try to rename without deleting the old file first.
-    (delete-file temp-path)
+    (if (access? temp-path F_OK)
+        (delete-file temp-path))
     (rename-file gnc:current-saved-reports temp-path)
     (hash-for-each (lambda (k v)
 		     (if (gnc:report-template-parent-type v)



More information about the gnucash-changes mailing list