chore: use a match instead of unwrap error

This commit is contained in:
mcfans 2023-11-07 12:51:16 +08:00
parent b522de3b56
commit 32a29a5556

View File

@ -1806,13 +1806,16 @@ impl Connection {
let encode_result = me.write_to_bytes();
if let Ok(data) = encode_result {
let result = call_main_service_key_event(&data);
if let Err(e) = result {
log::debug!("call_main_service_key_event fail:{}", e);
match encode_result {
Ok(data) => {
let result = call_main_service_key_event(&data);
if let Err(e) = result {
log::debug!("call_main_service_key_event fail: {}", e);
}
}
Err(e) => {
log::debug!("encode key event fail: {}", e);
}
} else {
log::debug!("encode key event fail:{}", encode_result.err().unwrap());
}
}
#[cfg(not(any(target_os = "android", target_os = "ios")))]