fix(ble/bluedroid): Optimize BLE function 'esp_ble_resolve_adv_data_by_type'

This commit is contained in:
zhanghaipeng 2024-08-26 19:27:36 +08:00
parent fff9b4e779
commit 243d6752ad

View File

@ -493,13 +493,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)) && if (((type < ESP_BLE_AD_TYPE_FLAG) || (type > ESP_BLE_AD_TYPE_128SERVICE_DATA)) &&
(type != ESP_BLE_AD_MANUFACTURER_SPECIFIC_TYPE)) { (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; *length = 0;
return NULL; return NULL;
} }
if (adv_data == NULL || adv_data_len == 0) { if (adv_data_len == 0) {
LOG_ERROR("Invalid advertising data.\n"); *length = 0;
return NULL;
}
if (adv_data == NULL) {
LOG_ERROR("Invalid advertising data.");
*length = 0; *length = 0;
return NULL; return NULL;
} }