From 73f8cc0826ff23364f56a88817f776632fafe4b9 Mon Sep 17 00:00:00 2001 From: Zhang Hai Peng Date: Wed, 3 Dec 2025 11:53:36 +0800 Subject: [PATCH] fix(ble/bt): Add NULL check in esp_hid_device example (cherry picked from commit 8e0f74a2cc52cd1ec5e039db34d09d4e07097f7b) Co-authored-by: zhanghaipeng --- examples/bluetooth/esp_hid_device/main/esp_hid_gap.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/examples/bluetooth/esp_hid_device/main/esp_hid_gap.c b/examples/bluetooth/esp_hid_device/main/esp_hid_gap.c index 36db8d87d0..c55f97cac7 100644 --- a/examples/bluetooth/esp_hid_device/main/esp_hid_gap.c +++ b/examples/bluetooth/esp_hid_device/main/esp_hid_gap.c @@ -278,6 +278,9 @@ static void handle_bt_device_result(struct disc_res_param *disc_res) GAP_DBG_PRINTF(", %s: ", gap_bt_prop_type_names[prop->type]); } if (prop->type == ESP_BT_GAP_DEV_PROP_BDNAME) { + if (prop->val == NULL) { + continue; + } name = (uint8_t *)prop->val; name_len = strlen((const char *)name); GAP_DBG_PRINTF("%s", (const char *)name);