mirror of
https://github.com/kidfromjupiter/nearby.git
synced 2026-09-14 22:56:12 -04:00
Fixes the bluetooth MAC address not contained in ble_advertisement if invalid. Add the reserved bytes.
PiperOrigin-RevId: 390290878
This commit is contained in:
committed by
Copybara-Service
parent
dc2d249cc4
commit
bf41ac7e9f
@@ -238,11 +238,16 @@ BleAdvertisement::operator ByteArray() const {
|
||||
// clang-format on
|
||||
|
||||
// The next 6 bytes are the bluetooth mac address. If bluetooth_mac_address
|
||||
// is invalid or empty, we get back a empty byte array.
|
||||
// is invalid or empty, we get back an empty byte array.
|
||||
auto bluetooth_mac_address_bytes{
|
||||
BluetoothUtils::FromString(bluetooth_mac_address_)};
|
||||
if (!bluetooth_mac_address_bytes.Empty()) {
|
||||
absl::StrAppend(&out, std::string(bluetooth_mac_address_bytes));
|
||||
} else {
|
||||
// If bluetooth MAC address is invalid, then reserve the bytes.
|
||||
auto fake_bt_mac_address_bytes =
|
||||
ByteArray(BluetoothUtils::kBluetoothMacAddressLength);
|
||||
absl::StrAppend(&out, std::string(fake_bt_mac_address_bytes));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user