fix 978144: exception with view send-email if empty subject stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Tue, 25 May 2010 11:56:16 +0200
branchstable
changeset 5579 297b2002a083
parent 5577 4e3ca117c275
child 5580 3e9e6dd54ebb
fix 978144: exception with view send-email if empty subject
mail.py
--- a/mail.py	Tue May 25 10:55:57 2010 +0200
+++ b/mail.py	Tue May 25 11:56:16 2010 +0200
@@ -85,8 +85,11 @@
     assert type(content) is unicode, repr(content)
     msg = MIMEText(content.encode('UTF-8'), 'plain', 'UTF-8')
     # safety: keep only the first newline
-    subject = subject.splitlines()[0]
-    msg['Subject'] = header(subject)
+    try:
+        subject = subject.splitlines()[0]
+        msg['Subject'] = header(subject)
+    except IndexError:
+        pass # no subject
     if uinfo.get('email'):
         email = uinfo['email']
     elif config and config['sender-addr']: