From 6fd49e9341d5673b70edfb333a4e5fa0a44128d2 Mon Sep 17 00:00:00 2001 From: Ricardo Wurmus Date: Fri, 4 Dec 2020 06:55:23 +0100 Subject: 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. --- mumi/messages.scm | 7 ++++--- 1 file 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)) -- cgit v1.2.3