From 5ec7c59d8aeeae7086c102d510d913e51f0ef2b6 Mon Sep 17 00:00:00 2001 From: Manos Pitsidianakis Date: Tue, 28 Jul 2020 16:16:49 +0300 Subject: [PATCH] melib/threads: re-add to missing_message_ids on remove --- melib/src/thread.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/melib/src/thread.rs b/melib/src/thread.rs index 7b2cb5df2..704636ff8 100644 --- a/melib/src/thread.rs +++ b/melib/src/thread.rs @@ -575,6 +575,9 @@ impl Threads { tree_index.remove(i); } } + if let Some((message_id, _)) = self.message_ids.iter().find(|(_, h)| **h == t_id) { + self.missing_message_ids.insert(message_id.to_vec()); + } } pub fn amend(&mut self, envelopes: &mut Envelopes) { @@ -1193,9 +1196,7 @@ impl Index<&ThreadNodeHash> for Threads { type Output = ThreadNode; fn index(&self, index: &ThreadNodeHash) -> &ThreadNode { - self.thread_nodes - .get(index) - .expect("thread index out of bounds") + self.thread_nodes.get(index).expect("thread node not found") } }