mirror of
https://github.com/Gnucash/gnucash.git
synced 2024-11-29 20:24:25 -06:00
Guard against divide-by-zero errors.
This commit is contained in:
parent
4e88b8cb6c
commit
fe73f52bdb
@ -193,11 +193,12 @@
|
||||
(second foreignlist)
|
||||
GNC-DENOM-AUTO
|
||||
GNC-DENOM-LCD))
|
||||
(gnc-numeric-div
|
||||
total-domestic
|
||||
total-foreign
|
||||
GNC-DENOM-AUTO
|
||||
(logior (GNC-DENOM-SIGFIGS 8) GNC-RND-ROUND)))))))
|
||||
(if (not (zero? total-foreign))
|
||||
(gnc-numeric-div
|
||||
total-domestic
|
||||
total-foreign
|
||||
GNC-DENOM-AUTO
|
||||
(logior (GNC-DENOM-SIGFIGS 8) GNC-RND-ROUND)) 0))))))
|
||||
;; Get all the interesting splits, and sort them according to the
|
||||
;; date.
|
||||
(gnc:get-match-commodity-splits-sorted
|
||||
@ -295,11 +296,12 @@
|
||||
(gnc-commodity-numeric->string
|
||||
report-currency (gnc-numeric-zero)))
|
||||
(gnc-numeric-zero))
|
||||
(gnc-numeric-div
|
||||
(second foreignlist)
|
||||
(third foreignlist)
|
||||
GNC-DENOM-AUTO
|
||||
(logior (GNC-DENOM-SIGFIGS 8) GNC-RND-ROUND))))))
|
||||
(if (not (zero? (third foreignlist)))
|
||||
(gnc-numeric-div
|
||||
(second foreignlist)
|
||||
(third foreignlist)
|
||||
GNC-DENOM-AUTO
|
||||
(logior (GNC-DENOM-SIGFIGS 8) GNC-RND-ROUND)) 0)))))
|
||||
;; Get all the interesting splits, sorted by date.
|
||||
(gnc:get-match-commodity-splits-sorted
|
||||
currency-accounts
|
||||
|
@ -203,10 +203,11 @@
|
||||
(begin
|
||||
(xaccSplitSetMemo split-1 memo)
|
||||
(xaccSplitSetMemo split-2 memo)))
|
||||
(if (> amount2 0)
|
||||
(gnc-pricedb-create (xaccAccountGetCommodity debit)
|
||||
(xaccAccountGetCommodity credit)
|
||||
(gnc-dmy2time64 DD MM YY)
|
||||
(/ amount1 amount2))
|
||||
(/ amount1 amount2)))
|
||||
(xaccTransCommitEdit txn)
|
||||
txn))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user