[PATCH] stg mail crashes when there is no patch description

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 "<empty message>" and forcing the edit_patches option on.
---

 stgit/commands/mail.py |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)


diff --git a/stgit/commands/mail.py b/stgit/commands/mail.py
index f12d694..63c4b39 100644
--- a/stgit/commands/mail.py
+++ b/stgit/commands/mail.py
@@ -393,7 +393,13 @@ 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()
+    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()
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux