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 ecae309092..b71de7f466 100644 --- a/components/bt/host/bluedroid/api/esp_gap_ble_api.c +++ b/components/bt/host/bluedroid/api/esp_gap_ble_api.c @@ -496,13 +496,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; }