imap: fix out of bounds panic on receive EXPUNGE

Closes #82
jmap-eventsource
Manos Pitsidianakis 2020-10-11 16:51:49 +03:00
parent 347b54e0f7
commit 5d968b7c40
Signed by: Manos Pitsidianakis
GPG Key ID: 73627C2F690DF710
1 changed files with 1 additions and 1 deletions

View File

@ -95,7 +95,7 @@ impl ImapConnection {
.unwrap()
.entry(mailbox_hash)
.or_default()
.remove(n.try_into().unwrap());
.remove(TryInto::<usize>::try_into(n).unwrap().saturating_sub(1));
debug!("expunge {}, UID = {}", n, deleted_uid);
let deleted_hash: crate::email::EnvelopeHash = match self
.uid_store