mirror of
https://github.com/chatmail/core.git
synced 2026-04-27 10:26:29 +03:00
if in doubt, prefer unwrap_or_default()
if the past we had lots of crashes because of unexpected unwrap failures, mostly related to string. this commit avoids them eg. for string-conversions that may panic eg. when encountering a null-byte or by logical programming errors where an object is assumed to be set but is not under unexpected circumstances.
This commit is contained in:
@@ -47,7 +47,7 @@ pub struct EncryptHelper {
|
||||
impl EncryptHelper {
|
||||
pub fn new(context: &Context) -> Result<EncryptHelper> {
|
||||
let prefer_encrypt =
|
||||
EncryptPreference::from_i32(context.get_config_int(Config::E2eeEnabled)).unwrap();
|
||||
EncryptPreference::from_i32(context.get_config_int(Config::E2eeEnabled)).unwrap_or_default();
|
||||
let addr = match context.get_config(Config::ConfiguredAddr) {
|
||||
None => {
|
||||
bail!("addr not configured!");
|
||||
|
||||
Reference in New Issue
Block a user