branch: elpa/csv2ledger
commit 80e39156a922329b82543780e303063160e261b2
Author: Joost Kremers <[email protected]>
Commit: Joost Kremers <[email protected]>

    Fix c2l-amount-is-amount.
    
    The default value of alist-get is only returned if the key returns nil, not 
if
    it returns the empty list, which is what would happen if the amount field is
    empty, because parse-csv-string returns an empty string in that case.
---
 csv2ledger.el | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/csv2ledger.el b/csv2ledger.el
index 00f154b950..68449e4843 100644
--- a/csv2ledger.el
+++ b/csv2ledger.el
@@ -264,7 +264,10 @@ TRANSACTION should be an alist containing field-value 
pairs and
 should contain a value for `amount', which is the return value.
 If `amount' does not contain a value, this function returns
 \"0.00\"."
-  (alist-get 'amount transaction "0.00"))
+  (let ((amount (alist-get 'amount transaction)))
+    (if (c2l--amount-p amount)
+        amount
+      "0.00")))
 
 (defun c2l-amount-is-credit-or-debit (transaction)
   "Return the amount of an entry.

Reply via email to