diff --git a/src/chat.rs b/src/chat.rs index 9d36f30d8..e33a7d7a5 100644 --- a/src/chat.rs +++ b/src/chat.rs @@ -4505,6 +4505,7 @@ pub(crate) async fn delete_and_reset_all_device_msgs(context: &Context) -> Resul /// Adds an informational message to chat. /// /// For example, it can be a message showing that a member was added to a group. +/// Doesn't fail if the chat doesn't exist. #[allow(clippy::too_many_arguments)] pub(crate) async fn add_info_msg_with_cmd( context: &Context, diff --git a/src/smtp.rs b/src/smtp.rs index 0c1bd33d7..406253e20 100644 --- a/src/smtp.rs +++ b/src/smtp.rs @@ -357,9 +357,9 @@ pub(crate) async fn send_msg_to_smtp( .await .context("failed to update retries count")?; - let (body, recipients, msg_id, retries) = context + let Some((body, recipients, msg_id, retries)) = context .sql - .query_row( + .query_row_optional( "SELECT mime, recipients, msg_id, retries FROM smtp WHERE id=?", (rowid,), |row| { @@ -370,7 +370,10 @@ pub(crate) async fn send_msg_to_smtp( Ok((mime, recipients, msg_id, retries)) }, ) - .await?; + .await? + else { + return Ok(()); + }; if retries > 6 { if let Some(mut msg) = Message::load_from_db_optional(context, msg_id).await? { message::set_msg_failed(context, &mut msg, "Number of retries exceeded the limit.")