mirror of
https://github.com/chatmail/core.git
synced 2026-04-29 11:26:29 +03:00
Fix get_draft to just return null and not produce errors if there's no
draft
This commit is contained in:
@@ -552,15 +552,13 @@ pub unsafe extern "C" fn dc_get_draft(context: *mut dc_context_t, chat_id: u32)
|
||||
return ptr::null_mut(); // NULL explicitly defined as "no draft"
|
||||
}
|
||||
let context = &*context;
|
||||
let message = match chat::get_draft(context, chat_id) {
|
||||
Ok(msg) => msg,
|
||||
Err(e) => {
|
||||
error!(context, "Failed to get draft for chat #{}: {}", chat_id, e);
|
||||
return ptr::null_mut();
|
||||
}
|
||||
|
||||
if let Some(message) = chat::get_draft(context, chat_id) {
|
||||
let ffi_msg = MessageWrapper { context, message };
|
||||
return Box::into_raw(Box::new(ffi_msg));
|
||||
};
|
||||
let ffi_msg = MessageWrapper { context, message };
|
||||
Box::into_raw(Box::new(ffi_msg))
|
||||
|
||||
ptr::null_mut()
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
|
||||
Reference in New Issue
Block a user