diff --git a/src/plugin/callback_msg.rs b/src/plugin/callback_msg.rs index 826aa159f..dfb0be27c 100644 --- a/src/plugin/callback_msg.rs +++ b/src/plugin/callback_msg.rs @@ -312,6 +312,15 @@ fn request_plugin_sign(id: String, msg_to_rustdesk: MsgToRustDesk) -> PluginRetu ) { Ok(ret) => { debug_assert!(!ret.msg.is_null(), "msg is null"); + if ret.msg.is_null() { + // unreachable + log::error!( + "The returned message pointer of plugin status is null, plugin id: '{}', code: {}", + id, + ret.code, + ); + return PluginReturn::success(); + } let msg = cstr_to_string(ret.msg).unwrap_or_default(); free_c_ptr(ret.msg as _); if ret.code == super::errno::ERR_SUCCESS { diff --git a/src/plugin/mod.rs b/src/plugin/mod.rs index d0b326dc3..be6e49ea8 100644 --- a/src/plugin/mod.rs +++ b/src/plugin/mod.rs @@ -81,7 +81,7 @@ impl PluginReturn { (self.code, "".to_owned()) } else { if self.msg.is_null() { - log::warn!("The message pointer is null"); + log::warn!("The message pointer from the plugin is null, but the error code is {}", self.code); return (self.code, "".to_owned()) } let msg = cstr_to_string(self.msg).unwrap_or_default();