From: Angus Salkeld Date: Mon, 24 Mar 2008 18:54:28 +0000 (+0000) Subject: stg mail crashes when there is no patch description X-Git-Tag: v0.14.2~1 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~mdw/git/stgit/commitdiff_plain/f3cec16e70129a705ec33feacf1cfbc6258ed8a8 stg mail crashes when there is no patch description 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 "" and forcing the edit_patches option on. --- diff --git a/stgit/commands/mail.py b/stgit/commands/mail.py index f256725..54ab5c9 100644 --- a/stgit/commands/mail.py +++ b/stgit/commands/mail.py @@ -394,9 +394,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 = '' + options.edit_patches = True + descr_lines = descr.split('\n') short_descr = descr_lines[0].rstrip() long_descr = '\n'.join(descr_lines[1:]).lstrip()