remove assert
Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
parent
5f0f4957b9
commit
31b96a44de
@ -311,7 +311,7 @@ fn request_plugin_sign(id: String, msg_to_rustdesk: MsgToRustDesk) -> PluginRetu
|
|||||||
&[],
|
&[],
|
||||||
) {
|
) {
|
||||||
Ok(ret) => {
|
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();
|
let msg = cstr_to_string(ret.msg).unwrap_or_default();
|
||||||
free_c_ptr(ret.msg as _);
|
free_c_ptr(ret.msg as _);
|
||||||
if ret.code == super::errno::ERR_SUCCESS {
|
if ret.code == super::errno::ERR_SUCCESS {
|
||||||
|
@ -80,7 +80,10 @@ impl PluginReturn {
|
|||||||
if self.is_success() {
|
if self.is_success() {
|
||||||
(self.code, "".to_owned())
|
(self.code, "".to_owned())
|
||||||
} else {
|
} 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();
|
let msg = cstr_to_string(self.msg).unwrap_or_default();
|
||||||
free_c_ptr(self.msg as _);
|
free_c_ptr(self.msg as _);
|
||||||
self.msg = null();
|
self.msg = null();
|
||||||
@ -146,7 +149,6 @@ fn get_uninstall_file_path() -> ResultType<PathBuf> {
|
|||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn cstr_to_string(cstr: *const c_char) -> ResultType<String> {
|
fn cstr_to_string(cstr: *const c_char) -> ResultType<String> {
|
||||||
assert!(!cstr.is_null(), "cstr must be a valid pointer");
|
|
||||||
if cstr.is_null() {
|
if cstr.is_null() {
|
||||||
bail!("failed to convert string, the pointer is null");
|
bail!("failed to convert string, the pointer is null");
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user