mirror of
https://github.com/chatmail/core.git
synced 2026-04-06 15:42:10 +03:00
better bubble up DB errors and guard one unwrap() where a crash occured during integration test run
(and possibly also related to #633)
This commit is contained in:
@@ -610,7 +610,7 @@ unsafe fn add_parts(
|
||||
let icnt = mime_parser.parts.len();
|
||||
let mut txt_raw = None;
|
||||
|
||||
let is_ok = context
|
||||
context
|
||||
.sql
|
||||
.prepare(
|
||||
"INSERT INTO msgs \
|
||||
@@ -697,13 +697,10 @@ unsafe fn add_parts(
|
||||
Ok(())
|
||||
},
|
||||
)
|
||||
.is_ok();
|
||||
|
||||
if !is_ok {
|
||||
// i/o error - there is nothing more we can do - in other cases, we try to write at least an empty record
|
||||
cleanup(mime_in_reply_to, mime_references);
|
||||
bail!("Cannot write DB.");
|
||||
}
|
||||
.map_err(|err| {
|
||||
cleanup(mime_in_reply_to, mime_references);
|
||||
err
|
||||
})?;
|
||||
|
||||
info!(
|
||||
context,
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
//! End-to-end encryption support.
|
||||
|
||||
use std::collections::HashSet;
|
||||
use std::ffi::CStr;
|
||||
use std::ptr;
|
||||
use std::str::FromStr;
|
||||
|
||||
@@ -479,8 +478,8 @@ fn update_gossip_peerstates(
|
||||
if !optional_field.fld_name.is_null()
|
||||
&& as_str(optional_field.fld_name) == "Autocrypt-Gossip"
|
||||
{
|
||||
let value = unsafe { CStr::from_ptr(optional_field.fld_value).to_str().unwrap() };
|
||||
let gossip_header = Aheader::from_str(value);
|
||||
let value = to_string_lossy(optional_field.fld_value);
|
||||
let gossip_header = Aheader::from_str(&value);
|
||||
|
||||
if let Ok(ref header) = gossip_header {
|
||||
if recipients.is_none() {
|
||||
|
||||
Reference in New Issue
Block a user