summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRicardo Wurmus <rekado@elephly.net>2020-12-04 06:55:23 +0100
committerRicardo Wurmus <rekado@elephly.net>2020-12-04 06:57:23 +0100
commit6fd49e9341d5673b70edfb333a4e5fa0a44128d2 (patch)
tree1d92046e07c0f9f35d5e710e77c589660f99faa4
parentd9f449d4a523b00922cd957b4b47fda01457d95b (diff)
messages: sender: Fail gracefully if "from" header is not a pair.
* mumi/messages.scm (sender): Fall back to "Unknown sender" if "from" header is not a pair.
-rw-r--r--mumi/messages.scm7
1 files changed, 4 insertions, 3 deletions
diff --git a/mumi/messages.scm b/mumi/messages.scm
index a743893..ae39b9a 100644
--- a/mumi/messages.scm
+++ b/mumi/messages.scm
@@ -85,9 +85,10 @@ yet. Return new results alongside cached results."
(assoc-ref (or (email-headers message) '()) key))
(define (sender message)
- (or (and=> (header message 'from) first)
- '((name . "Unknown sender")
- (address . "unknown"))))
+ (let ((from (header message 'from)))
+ (or (false-if-exception (and=> from first))
+ `((name . ,(or from "Unknown sender"))
+ (address . "unknown")))))
(define sender-email
(compose extract-email sender))