Browse Source

melib/collection: ensure mailbox exists when inserting new envelopes

Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
Manos Pitsidianakis 7 months ago
parent
commit
fb5a88c2
1 changed files with 4 additions and 0 deletions
  1. 4 0
      melib/src/collection.rs

+ 4 - 0
melib/src/collection.rs

@@ -365,6 +365,10 @@ impl Collection {
 
     pub fn insert(&self, envelope: Envelope, mailbox_hash: MailboxHash) -> bool {
         let hash = envelope.hash();
+
+        // Ensure mailbox exists in collection.
+        self.new_mailbox(mailbox_hash);
+
         self.mailboxes
             .write()
             .unwrap()