remove assert

Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
fufesou 2023-05-16 16:11:45 +08:00
parent 5f0f4957b9
commit 31b96a44de
2 changed files with 5 additions and 3 deletions

View File

@ -311,7 +311,7 @@ fn request_plugin_sign(id: String, msg_to_rustdesk: MsgToRustDesk) -> PluginRetu
&[],
) {
Ok(ret) => {
assert!(!ret.msg.is_null());
debug_assert!(!ret.msg.is_null(), "msg is null");
let msg = cstr_to_string(ret.msg).unwrap_or_default();
free_c_ptr(ret.msg as _);
if ret.code == super::errno::ERR_SUCCESS {

View File

@ -80,7 +80,10 @@ impl PluginReturn {
if self.is_success() {
(self.code, "".to_owned())
} else {
debug_assert!(!self.msg.is_null(), "msg is null");
if self.msg.is_null() {
log::warn!("The message pointer is null");
return (self.code, "".to_owned())
}
let msg = cstr_to_string(self.msg).unwrap_or_default();
free_c_ptr(self.msg as _);
self.msg = null();
@ -146,7 +149,6 @@ fn get_uninstall_file_path() -> ResultType<PathBuf> {
#[inline]
fn cstr_to_string(cstr: *const c_char) -> ResultType<String> {
assert!(!cstr.is_null(), "cstr must be a valid pointer");
if cstr.is_null() {
bail!("failed to convert string, the pointer is null");
}