[Nearby Presence] Check IsValid() before accessing impl_

Adding a check to `IsInvalid()` before accessing `impl_` in
`Blev2Medium::IsExtendedAdvertisementsAvailable()` to prevent a crash when
`impl_` is nullptr (which occurs when BleV2 is disabled).

PiperOrigin-RevId: 635854690
This commit is contained in:
Juliet Levesque
2024-05-21 10:38:27 -07:00
committed by Copybara-Service
parent 4472598508
commit 84bb5700c4
+1 -1
View File
@@ -224,7 +224,7 @@ BleV2Socket BleV2Medium::Connect(const std::string& service_id,
}
bool BleV2Medium::IsExtendedAdvertisementsAvailable() {
return impl_->IsExtendedAdvertisementsAvailable();
return IsValid() && impl_->IsExtendedAdvertisementsAvailable();
}
BleV2Peripheral BleV2Medium::GetRemotePeripheral(