summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyle Meyer <kyle@kyleam.com>2020-07-19 23:38:02 -0400
committerKyle Meyer <kyle@kyleam.com>2020-07-19 23:38:18 -0400
commited0351ba8fe3774b008b5675d6e9332bfe171e13 (patch)
tree8eb955b704a295652c8e022ede4f5293662d94cc
parent78e626cf14762494ac2fdfa5e9758ffb10642436 (diff)
downloadpiem-ed0351ba8fe3774b008b5675d6e9332bfe171e13.tar.gz
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.
-rw-r--r--piem.el8
1 files 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