Skip to content

Commit

Permalink
Bug 799224 - Import of QIF gets Bug detected during duplicates (parti…
Browse files Browse the repository at this point in the history
…al fix)

If the new-splits object is null, it means the new account tree from
the current import has no splits. Therefore the (apply min|max dates)
will fail. Omitting the date query is a simple fix to prevent crashing.

This is a partial fix because the crash is likely a symptom of another
bug which causes the new account-tree to be empty.
  • Loading branch information
christopherlam committed Jan 21, 2024
1 parent f7e3038 commit e8bb8b6
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions gnucash/import-export/qif-imp/qif-merge-groups.scm
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,14 @@
(dates (map (compose xaccTransGetDate xaccSplitGetParent) new-splits)))
(qof-query-set-book q (gnc-account-get-book old-root))
(xaccQueryAddAccountMatch q old-accounts QOF-GUID-MATCH-ANY QOF-QUERY-AND)
(xaccQueryAddDateMatchTT q
#t (decdate (apply min dates) WeekDelta)
#t (incdate (apply max dates) WeekDelta)
QOF-QUERY-AND)
(cond
((null? dates)
(gnc:warn "Probable error: the new account tree has no transactions."))
(else
(xaccQueryAddDateMatchTT q
#t (decdate (apply min dates) WeekDelta)
#t (incdate (apply max dates) WeekDelta)
QOF-QUERY-AND)))
(let ((splits (qof-query-run q)))
(qof-query-destroy q)
splits)))
Expand Down

0 comments on commit e8bb8b6

Please sign in to comment.