diff --git a/components/bt/host/bluedroid/api/esp_gap_ble_api.c b/components/bt/host/bluedroid/api/esp_gap_ble_api.c index 7be826617c..d37f3724be 100644 --- a/components/bt/host/bluedroid/api/esp_gap_ble_api.c +++ b/components/bt/host/bluedroid/api/esp_gap_ble_api.c @@ -512,13 +512,17 @@ uint8_t *esp_ble_resolve_adv_data_by_type( uint8_t *adv_data, uint16_t adv_data_ if (((type < ESP_BLE_AD_TYPE_FLAG) || (type > ESP_BLE_AD_TYPE_128SERVICE_DATA)) && (type != ESP_BLE_AD_MANUFACTURER_SPECIFIC_TYPE)) { - LOG_ERROR("the eir type not define, type = %x\n", type); + LOG_ERROR("The advertising data type is not defined, type = %x", type); *length = 0; return NULL; } - if (adv_data == NULL || adv_data_len == 0) { - LOG_ERROR("Invalid advertising data.\n"); + if (adv_data_len == 0) { + *length = 0; + return NULL; + } + if (adv_data == NULL) { + LOG_ERROR("Invalid advertising data."); *length = 0; return NULL; }