From ba05d5c142b2f9edc519fb27444b7e379f78ea21 Mon Sep 17 00:00:00 2001 From: taks <857tn859@gmail.com> Date: Thu, 16 Nov 2023 09:37:49 +0900 Subject: [PATCH] Changed to accept invalid ut8 string. --- src/client/ble_advertised_device.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/client/ble_advertised_device.rs b/src/client/ble_advertised_device.rs index 5a054d0..73bd837 100644 --- a/src/client/ble_advertised_device.rs +++ b/src/client/ble_advertised_device.rs @@ -104,7 +104,7 @@ impl BLEAdvertisedDevice { self.ad_flag = Some(data[0]); } esp_idf_sys::BLE_HS_ADV_TYPE_INCOMP_NAME | esp_idf_sys::BLE_HS_ADV_TYPE_COMP_NAME => { - self.name = String::from_utf8(data.to_vec()).unwrap(); + self.name = unsafe { String::from_utf8_unchecked(data.to_vec()) }; } esp_idf_sys::BLE_HS_ADV_TYPE_TX_PWR_LVL => { self.tx_power = Some(data[0]);