Skip to content

Commit b8a1673

Browse files
committed
models: Handle unset 'Submission.content'
It's unlikely but 'Submission.content' is nullable and we weren't handling this here. Fix that. Signed-off-by: Stephen Finucane <stephen@that.guru> Fixes: 7f6685a ("Fix CRLF newlines upon submission changes")
1 parent 563557a commit b8a1673

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

patchwork/models.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,9 @@ def save(self, *args, **kwargs):
347347
# message content to '\r\n'. We need to fix them to avoid problems,
348348
# especially as git complains about malformed patches when PW runs
349349
# on PY2
350-
self.content = self.content.replace('\r\n', '\n')
350+
if self.content:
351+
self.content = self.content.replace('\r\n', '\n')
352+
351353
super(EmailMixin, self).save(*args, **kwargs)
352354

353355
class Meta:

0 commit comments

Comments
 (0)