{"thread":{"id":"12376","subject":"[PATCH] stg mail crashes when there is no patch description","startedAt":"2008-02-28T23:14:36Z","lastAt":"2008-02-28T23:14:36Z","messageCount":1,"participants":["Angus Salkeld"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"70331","messageId":"8daa1da0802281514wcaaafc0m436311f0046ba0c@mail.gmail.com","threadId":"12376","inReplyTo":null,"subject":"[PATCH] stg mail crashes when there is no patch description","fromName":"Angus Salkeld","fromEmail":"ahsalkeld@gmail.com","sentAt":"2008-02-28T23:14:36Z","receivedAt":"2008-02-28T23:14:36Z","isPatch":true,"sender":{"key":"ahsalkeld@gmail.com","avatar":null},"body":"stg mail crashes when there is no patch description\n\nThe error is:\nFile \"/usr/lib/python2.4/site-packages/stgit/commands/mail.py\", line\n397, in __build_message\ndescr = p.get_description().strip()\nAttributeError: 'NoneType' object has no attribute 'strip'\n\nThis patch tries to handle this a bit better by setting the description\nto \"<empty message>\" and forcing the edit_patches option on.\n---\n\n stgit/commands/mail.py |    8 +++++++-\n 1 files changed, 7 insertions(+), 1 deletions(-)\n\n\ndiff --git a/stgit/commands/mail.py b/stgit/commands/mail.py\nindex f12d694..63c4b39 100644\n--- a/stgit/commands/mail.py\n+++ b/stgit/commands/mail.py\n@@ -393,7 +393,13 @@ def __build_message(tmpl, patch, patch_nr,\ntotal_nr, msg_id, ref_id, options):\n     \"\"\"\n     p = crt_series.get_patch(patch)\n\n-    descr = p.get_description().strip()\n+    if p.get_description():\n+        descr = p.get_description().strip()\n+    else:\n+        # provide a place holder and force the edit message option on\n+        descr = '<empty message>'\n+        options.edit_patches = True\n+\n     descr_lines = descr.split('\\n')\n\n     short_descr = descr_lines[0].rstrip()\n"}]}