From: Stephen Finucane Date: Sun, 7 Jul 2019 16:10:42 +0000 (+0100) Subject: models: Handle unset 'Submission.content' X-Git-Tag: v2.2.0-rc2~7 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b8a1673e356f2ad49f83eff82262b8d3c066f2fd;p=thirdparty%2Fpatchwork.git 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") --- diff --git a/patchwork/models.py b/patchwork/models.py index be71d407..08ee341e 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: