aboutsummaryrefslogtreecommitdiff
path: root/b4/__init__.py
diff options
context:
space:
mode:
Diffstat (limited to 'b4/__init__.py')
-rw-r--r--b4/__init__.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/b4/__init__.py b/b4/__init__.py
index 07f2aad..b10b3e1 100644
--- a/b4/__init__.py
+++ b/b4/__init__.py
@@ -827,7 +827,12 @@ class LoreMessage:
except IndexError:
pass
- self.date = email.utils.parsedate_to_datetime(str(self.msg['Date']))
+ msgdate = self.msg.get('Date')
+ if msgdate:
+ self.date = email.utils.parsedate_to_datetime(str(msgdate))
+ else:
+ # An email without a Date: field?
+ self.date = datetime.datetime.now()
diffre = re.compile(r'^(---.*\n\+\+\+|GIT binary patch|diff --git \w/\S+ \w/\S+)', re.M | re.I)
diffstatre = re.compile(r'^\s*\d+ file.*\d+ (insertion|deletion)', re.M | re.I)