Ensure book returns current-book

fixes https://lists.gnucash.org/pipermail/gnucash-user/2019-September/086967.html

because occasionally account will be null or #f, causing error when
passed to gnc-account-get-book.
This commit is contained in:
Christopher Lam 2019-09-20 09:04:34 +08:00
parent 0ab0d23b00
commit 49372e76be
2 changed files with 3 additions and 7 deletions

View File

@ -748,8 +748,8 @@
(end-date (gnc:time64-end-day-time
(gnc:date-option-absolute-time
(opt-val gnc:pagename-general optname-to-date))))
(book (gnc-account-get-book account))
(date-format (if (not (null? book)) (gnc:options-fancy-date book)))
(book (gnc-get-current-book))
(date-format (gnc:options-fancy-date book))
(type (opt-val "__reg" "owner-type"))
(owner-descr (owner-string type))
(date-type (opt-val gnc:pagename-general optname-date-driver))

View File

@ -505,11 +505,7 @@
(validate (reverse
(gnc-account-get-children-sorted
(gnc-get-current-root-account))))))
(book (if selected-accounts
(gnc-account-get-book (if (pair? selected-accounts)
(car selected-accounts)
selected-accounts))
#f))
(book (gnc-get-current-book))
(generations (if (pair? selected-accounts)
(apply max (map (lambda (x) (num-generations x 1))
selected-accounts))