From b8a1673e356f2ad49f83eff82262b8d3c066f2fd Mon Sep 17 00:00:00 2001 From: Stephen Finucane Date: Sun, 7 Jul 2019 17:10:42 +0100 Subject: 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 Fixes: 7f6685a2a ("Fix CRLF newlines upon submission changes") --- patchwork/models.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/patchwork/models.py b/patchwork/models.py index be71d40..08ee341 100644 --- a/patchwork/models.py +++ b/patchwork/models.py @@ -347,7 +347,9 @@ class EmailMixin(models.Model): # message content to '\r\n'. We need to fix them to avoid problems, # especially as git complains about malformed patches when PW runs # on PY2 - self.content = self.content.replace('\r\n', '\n') + if self.content: + self.content = self.content.replace('\r\n', '\n') + super(EmailMixin, self).save(*args, **kwargs) class Meta: -- cgit v1.2.3