diff options
author | Ricardo Wurmus <rekado@elephly.net> | 2020-12-04 06:55:23 +0100 |
---|---|---|
committer | Ricardo Wurmus <rekado@elephly.net> | 2020-12-04 06:57:23 +0100 |
commit | 6fd49e9341d5673b70edfb333a4e5fa0a44128d2 (patch) | |
tree | 1d92046e07c0f9f35d5e710e77c589660f99faa4 | |
parent | d9f449d4a523b00922cd957b4b47fda01457d95b (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.scm | 7 |
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)) |