Try to fix a crash when checking Bluetooth state

PiperOrigin-RevId: 568982667
This commit is contained in:
Guogang Li
2023-09-27 15:47:17 -07:00
committed by Copybara-Service
parent 42787803fd
commit a1a442c8eb
@@ -40,7 +40,7 @@ using WindowsBluetoothAdapter =
// Represents a radio device on the system.
// https://docs.microsoft.com/en-us/uwp/api/windows.devices.radios.radio?view=winrt-20348
using winrt::Windows::Devices::Radios::IRadio;
using winrt::Windows::Devices::Radios::Radio;
// Enumeration that describes possible radio states.
// https://docs.microsoft.com/en-us/uwp/api/windows.devices.radios.radiostate?view=winrt-20348
@@ -115,10 +115,10 @@ class BluetoothAdapter : public api::BluetoothAdapter {
void StoreRadioNames(absl::string_view original_radio_name,
absl::string_view nearby_radio_name);
WindowsBluetoothAdapter windows_bluetooth_adapter_;
WindowsBluetoothAdapter windows_bluetooth_adapter_ = nullptr;
std::string registry_bluetooth_adapter_name_;
IRadio windows_bluetooth_radio_;
Radio windows_bluetooth_radio_ = nullptr;
std::optional<std::string> GetGenericBluetoothAdapterInstanceID() const;
void find_and_replace(char *source, const char *strFind,
const char *strReplace) const;