From 6c2ab5c940c413fecba8d1c89acf96a947512f27 Mon Sep 17 00:00:00 2001 From: Stephen Morgan Date: Wed, 5 May 2021 14:50:58 +1000 Subject: [PATCH] lib: When matching an account query against a posting, don't try to match against the same posting twice, in cases when poriginal is Nothing. --- hledger-lib/Hledger/Query.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hledger-lib/Hledger/Query.hs b/hledger-lib/Hledger/Query.hs index bf7a9e3ef..975cea6b2 100644 --- a/hledger-lib/Hledger/Query.hs +++ b/hledger-lib/Hledger/Query.hs @@ -608,7 +608,7 @@ matchesPosting (Or qs) p = any (`matchesPosting` p) qs matchesPosting (And qs) p = all (`matchesPosting` p) qs matchesPosting (Code r) p = maybe False (regexMatchText r . tcode) $ ptransaction p matchesPosting (Desc r) p = maybe False (regexMatchText r . tdescription) $ ptransaction p -matchesPosting (Acct r) p = matches p || matches (originalPosting p) +matchesPosting (Acct r) p = matches p || maybe False matches (poriginal p) where matches = regexMatchText r . paccount matchesPosting (Date span) p = span `spanContainsDate` postingDate p matchesPosting (Date2 span) p = span `spanContainsDate` postingDate2 p