1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-26 23:22:21 +01:00
This commit is contained in:
J. Nick Koston
2025-07-25 17:20:37 -10:00
parent a06c4e1d56
commit 535e995c75

View File

@@ -105,7 +105,12 @@ void BluetoothConnection::send_service_for_discovery_() {
return;
}
if (total_char_count > 0) {
if (total_char_count == 0) {
// No characteristics, just send the service response
api_conn->send_message(resp, api::BluetoothGATTGetServicesResponse::MESSAGE_TYPE);
return
}
// Reserve space and process characteristics
service_resp.characteristics.reserve(total_char_count);
uint16_t char_offset = 0;
@@ -173,7 +178,6 @@ void BluetoothConnection::send_service_for_discovery_() {
desc_offset++;
}
}
} // end else if (total_char_count > 0)
// Send the message (we already checked api_conn is not null at the beginning)
api_conn->send_message(resp, api::BluetoothGATTGetServicesResponse::MESSAGE_TYPE);