mirror of
https://github.com/chatmail/core.git
synced 2026-05-02 12:56:30 +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:
@@ -695,7 +695,7 @@ impl<'a> MimeFactory<'a> {
|
||||
Ok(())
|
||||
},
|
||||
)
|
||||
.unwrap();
|
||||
.unwrap_or_default();
|
||||
|
||||
let command = factory.msg.param.get_cmd();
|
||||
let msg = &factory.msg;
|
||||
@@ -900,7 +900,7 @@ fn build_body_file(
|
||||
let mime_sub = mailmime_new_empty(content, mime_fields);
|
||||
let abs_path = dc_get_abs_path(context, path_filename)
|
||||
.to_c_string()
|
||||
.unwrap();
|
||||
.unwrap_or_default();
|
||||
mailmime_set_body_file(mime_sub, dc_strdup(abs_path.as_ptr()));
|
||||
Ok((mime_sub, filename_to_send))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user