emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/csv2ledger 59ba841805 086/190: Guard against empty payee a


From: ELPA Syncer
Subject: [nongnu] elpa/csv2ledger 59ba841805 086/190: Guard against empty payee and sender in c2l-title-is-payee-or-sender
Date: Sun, 2 Jun 2024 15:59:48 -0400 (EDT)

branch: elpa/csv2ledger
commit 59ba8418055359018f5ecb0e1aa12168b1eb4a39
Author: Joost Kremers <joostkremers@fastmail.fm>
Commit: Joost Kremers <joostkremers@fastmail.fm>

    Guard against empty payee and sender in c2l-title-is-payee-or-sender
---
 csv2ledger.el | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/csv2ledger.el b/csv2ledger.el
index e30b42a890..2861bf615b 100644
--- a/csv2ledger.el
+++ b/csv2ledger.el
@@ -242,11 +242,16 @@ should contain values for `payee' and `sender'.  If the 
value of
 otherwise the payee is returned."
   (let ((payee (alist-get 'payee transaction))
         (sender (alist-get 'sender transaction)))
-    (if (stringp c2l-account-holder)
-        (if (string-match-p c2l-account-holder payee)
-            sender
-          payee)
-      payee)))
+    (cond
+     ((and (string-empty-p payee)
+           (string-empty-p sender))
+      "Unknown")
+     ((string-empty-p payee) sender)
+     ((string-empty-p sender) payee)
+     ((and (stringp c2l-account-holder)
+           (string-match-p c2l-account-holder payee))
+      sender)
+     (t payee))))
 
 (defun c2l-title-is-counterpart (transaction)
   "Return the counterpart of an entry.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]