From aaa5789ba792a3b268effbf4beaae4c93525b0dc Mon Sep 17 00:00:00 2001 From: Konstantin Ryabitsev Date: Tue, 27 Oct 2020 14:55:20 -0400 Subject: Fix a crasher discovered in testing Don't crash on incomplete threads when trying to carry over previous trailers. Signed-off-by: Konstantin Ryabitsev --- b4/__init__.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'b4/__init__.py') diff --git a/b4/__init__.py b/b4/__init__.py index 7e38e13..2a8bcb8 100644 --- a/b4/__init__.py +++ b/b4/__init__.py @@ -304,10 +304,11 @@ class LoreMailbox: # previous revisions to current revision if patch/metadata did # not change pmsg.load_hashes() - attid = pmsg.attestation.attid - if attid not in self.trailer_map: - self.trailer_map[attid] = list() - self.trailer_map[attid] += trailers + if pmsg.attestation: + attid = pmsg.attestation.attid + if attid not in self.trailer_map: + self.trailer_map[attid] = list() + self.trailer_map[attid] += trailers pmsg.followup_trailers += trailers break if not pmsg.reply: @@ -2035,6 +2036,7 @@ def get_pi_thread_by_msgid(msgid, savefile, useproject=None, nocache=False): tmp_mbox = mkstemp('b4-lookup-mbox')[1] in_mbxf = get_pi_thread_by_url(t_mbx_url, tmp_mbox, nocache=nocache) if not in_mbxf: + os.unlink(tmp_mbox) return None in_mbx = mailbox.mbox(in_mbxf) out_mbx = mailbox.mbox(savefile) -- cgit v1.2.3