branch: elpa/csv2ledger
commit 8f1c8fa2b6160b292745d17d4bc9a1e6b38cf834
Author: Joost Kremers <joostkrem...@fastmail.fm>
Commit: Joost Kremers <joostkrem...@fastmail.fm>

    Guard for the case where payee or sender does not exist.
    
    If the payee or (more likely) sender is not in the CSV file, running 
alist-get
    on it without a default value will yield nil. When passed to 
string-empty-p, the
    result is nil, because the symbol name of nil is not an empty string. This 
could
    lead to nil appearing as the title of an entry. By having alist-get return 
the
    empty string as default value, this is avoided.
---
 csv2ledger.el | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/csv2ledger.el b/csv2ledger.el
index 8246e88a91..23c2ca78fb 100644
--- a/csv2ledger.el
+++ b/csv2ledger.el
@@ -240,8 +240,8 @@ TRANSACTION should be an alist containing field-value pairs 
and
 should contain values for `payee' and `sender'.  If the value of
 `c2l-account-holder' matches the payee, the sender is returned,
 otherwise the payee is returned."
-  (let ((payee (alist-get 'payee transaction))
-        (sender (alist-get 'sender transaction)))
+  (let ((payee (alist-get 'payee transaction ""))
+        (sender (alist-get 'sender transaction "")))
     (cond
      ((and (string-empty-p payee)
            (string-empty-p sender))

Reply via email to