From 11ad01aa85a64385b7fa62bc4b7459970ac7e5e1 Mon Sep 17 00:00:00 2001 From: "Bjarni R. Einarsson" Date: Wed, 1 Jul 2015 12:38:55 +0100 Subject: [PATCH] Make reply creation logic more robust to not having a from address --- mailpile/plugins/compose.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/mailpile/plugins/compose.py b/mailpile/plugins/compose.py index ea3e00ee2..36e800e5a 100644 --- a/mailpile/plugins/compose.py +++ b/mailpile/plugins/compose.py @@ -431,7 +431,8 @@ def merge_contact(ai): force_name=True) def addresses(addrs, exclude=[]): - alist = [from_ai.address] + [a.address for a in exclude] + alist = [from_ai.address] if (from_ai) else [] + alist += [a.address for a in exclude] return [merge_contact(a) for a in addrs if a.address not in alist and not a.address.startswith('noreply@') @@ -439,8 +440,9 @@ def addresses(addrs, exclude=[]): # If only replying to messages sent from chosen from, then this is # a follow-up or clarification, so just use the same headers. - if len([e for e in ref_from if e.address == from_ai.address] - ) == len(ref_from): + if (from_ai and + len([e for e in ref_from + if e and e.address == from_ai.address]) == len(ref_from)): if ref_to: result['to'] = addresses(ref_to) if ref_cc: