chiark / gitweb /
stg mail crashes when there is no patch description
authorAngus Salkeld <ahsalkeld@gmail.com>
Thu, 20 Mar 2008 23:12:10 +0000 (23:12 +0000)
committerCatalin Marinas <catalin.marinas@gmail.com>
Thu, 20 Mar 2008 23:12:10 +0000 (23:12 +0000)
The error is:
File "/usr/lib/python2.4/site-packages/stgit/commands/mail.py", line
397, in __build_message
descr = p.get_description().strip()
AttributeError: 'NoneType' object has no attribute 'strip'

This patch tries to handle this a bit better by setting the
description to "<empty message>" and forcing the edit_patches option
on.

stgit/commands/mail.py

index f12d6948b5085cc1167e1968b959cbf21292755c..176c557f923f628de6371e49247a2516110a6e5f 100644 (file)
@@ -393,9 +393,14 @@ def __build_message(tmpl, patch, patch_nr, total_nr, msg_id, ref_id, options):
     """
     p = crt_series.get_patch(patch)
 
-    descr = p.get_description().strip()
-    descr_lines = descr.split('\n')
+    if p.get_description():
+        descr = p.get_description().strip()
+    else:
+        # provide a place holder and force the edit message option on
+        descr = '<empty message>'
+        options.edit_patches = True
 
+    descr_lines = descr.split('\n')
     short_descr = descr_lines[0].rstrip()
     long_descr = '\n'.join(descr_lines[1:]).lstrip()