Fix a crash in the receivable aging report (#384879)

Dont access the owner object after it's freed.

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@16724 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Derek Atkins 2007-12-26 01:38:45 +00:00
parent 04243f92fc
commit 480bb412c7

View File

@ -196,20 +196,27 @@
;; if it's an existing company, destroy the temp owner and
;; then make sure the currencies match
(begin
(gncOwnerDestroy temp-owner)
(if (not (gnc-commodity-equiv
this-currency
(company-get-currency company-info)))
(cons #f (sprintf
(_ "Transactions relating to '%s' contain \
more than one currency. This report is not designed to cope with this possibility.") (gncOwnerGetName owner)))
(let ((error-str
(string-append "IGNORING TRANSACTION!\n" "Invoice Owner: " (gncOwnerGetName owner)
"\nTransaction GUID:" (gncTransGetGuid transaction)
"\nTransaction Currency" (gnc-commodity-get-mnemonic this-currency)
"\nClient Currency" (gnc-ommodity-get-mnemonic(company-get-currency company-info)))))
(gnc-error-dialog '() error-str)
(gnc:error error-str)
(cons #f (sprintf
(_ "Transactions relating to '%s' contain \
+more than one currency. This report is not designed to cope with this possibility.") (gncOwnerGetName owner))))
(begin
(gnc:debug "it's an old company")
(if (gnc-numeric-negative-p value)
(process-invoice company-info (gnc-numeric-neg value) bucket-intervals this-date)
(process-payment company-info value))
(hash-set! hash guid company-info)
(cons #t guid))))
(cons #t guid)))
(gncOwnerDestroy temp-owner))
;; if it's a new company
(begin