From ed0351ba8fe3774b008b5675d6e9332bfe171e13 Mon Sep 17 00:00:00 2001 From: Kyle Meyer Date: Sun, 19 Jul 2020 23:38:02 -0400 Subject: Don't assume "From:" exists when extracting info I hit into a type error by calling piem-am, without thinking, on an attachment of a plain diff. --- piem.el | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/piem.el b/piem.el index 49c074d..406665f 100644 --- a/piem.el +++ b/piem.el @@ -447,8 +447,8 @@ the first will be ignored." (save-restriction (message-narrow-to-head) (list :date (message-fetch-field "date") - :from (rfc2047-decode-string - (message-fetch-field "from")) + :from (when-let ((from (message-fetch-field "from"))) + (rfc2047-decode-string from)) :subject (message-fetch-field "subject")))))) (when (re-search-forward (rx line-start "base-commit: " (group (>= 40 hex-digit)) @@ -501,8 +501,8 @@ indicated in the subject. INFO is a plist with properties documented in `piem-default-branch-function'." - (when-let ((sender (car (mail-extract-address-components - (plist-get info :from)))) + (when-let ((from (plist-get info :from)) + (sender (car (mail-extract-address-components from))) (subject (plist-get info :subject))) (let* ((subnames (split-string sender)) (initials (mapconcat -- cgit v1.2.3