From 2bc50b8d4ad9271efcf416870943dfee2411c76c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?C=C3=A9lestin=20Matte?= <gitlab@cmatte.me>
Date: Thu, 3 Feb 2022 09:18:21 +0100
Subject: [PATCH 2/2] Avoid possible crash in views.py when parentid is null

---
 django/archives/mailarchives/views.py | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/django/archives/mailarchives/views.py b/django/archives/mailarchives/views.py
index bf3336e..1d0df04 100644
--- a/django/archives/mailarchives/views.py
+++ b/django/archives/mailarchives/views.py
@@ -480,13 +480,12 @@ def message(request, msgid):
 
     responses = [t for t in threadstruct if t['parentid'] == m.id]
 
+    parent = None
     if m.parentid:
         for t in threadstruct:
             if t['id'] == m.parentid:
                 parent = t
                 break
-    else:
-        parent = None
     nextprev = _get_nextprevious(listmap, m.date)
 
     r = render_nav(NavContext(request, lists[0].listid, lists[0].listname), 'message.html', {
-- 
2.42.0

