mirror of
https://github.com/chatmail/core.git
synced 2026-05-02 04:46:29 +03:00
Use if let to avoid unwrap() of peerstate
This commit is contained in:
committed by
holger krekel
parent
a82f2a5df3
commit
742f603b3b
@@ -1374,12 +1374,11 @@ fn check_verified_properties(
|
|||||||
context.is_self_addr(&to_addr)
|
context.is_self_addr(&to_addr)
|
||||||
);
|
);
|
||||||
let mut is_verified = _is_verified != 0;
|
let mut is_verified = _is_verified != 0;
|
||||||
let mut peerstate = Peerstate::from_addr(context, &context.sql, &to_addr);
|
let peerstate = Peerstate::from_addr(context, &context.sql, &to_addr);
|
||||||
|
|
||||||
// mark gossiped keys (if any) as verified
|
// mark gossiped keys (if any) as verified
|
||||||
if mimeparser.gossipped_addr.contains(&to_addr) && peerstate.is_some() {
|
if mimeparser.gossipped_addr.contains(&to_addr) {
|
||||||
let peerstate = peerstate.as_mut().unwrap();
|
if let Some(mut peerstate) = peerstate {
|
||||||
|
|
||||||
// if we're here, we know the gossip key is verified:
|
// if we're here, we know the gossip key is verified:
|
||||||
// - use the gossip-key as verified-key if there is no verified-key
|
// - use the gossip-key as verified-key if there is no verified-key
|
||||||
// - OR if the verified-key does not match public-key or gossip-key
|
// - OR if the verified-key does not match public-key or gossip-key
|
||||||
@@ -1402,6 +1401,7 @@ fn check_verified_properties(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if !is_verified {
|
if !is_verified {
|
||||||
bail!(
|
bail!(
|
||||||
"{} is not a member of this verified group",
|
"{} is not a member of this verified group",
|
||||||
|
|||||||
Reference in New Issue
Block a user