melib/collection: ensure mailbox exists when inserting new envelopes

Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
This commit is contained in:
Manos Pitsidianakis 2024-11-21 11:45:52 +02:00
parent 567270e177
commit fb5a88c22c
No known key found for this signature in database
GPG key ID: 7729C7707F7E09D0

View file

@ -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()