mirror of
https://github.com/kidfromjupiter/nearby.git
synced 2026-09-14 22:56:12 -04:00
Fixed the crash when connecting a remote target from Win to Phone
PiperOrigin-RevId: 472502070
This commit is contained in:
committed by
Copybara-Service
parent
525283a166
commit
851f5ec0dd
@@ -284,6 +284,12 @@ std::unique_ptr<api::BluetoothSocket> BluetoothClassicMedium::ConnectToService(
|
||||
NEARBY_LOGS(ERROR) << __func__ << ": Exception connecting bluetooth async: "
|
||||
<< exception.what();
|
||||
return nullptr;
|
||||
} catch (const winrt::hresult_error& ex) {
|
||||
NEARBY_LOGS(ERROR) << __func__
|
||||
<< ": Exception connecting bluetooth async, error code: "
|
||||
<< ex.code()
|
||||
<< ", error message: " << winrt::to_string(ex.message());
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return std::move(rfcomm_socket);
|
||||
@@ -606,9 +612,7 @@ bool BluetoothClassicMedium::StartAdvertising(bool radio_discoverable) {
|
||||
return false;
|
||||
}
|
||||
|
||||
server_socket_->SetCloseNotifier([&]() {
|
||||
StopAdvertising();
|
||||
});
|
||||
server_socket_->SetCloseNotifier([&]() { StopAdvertising(); });
|
||||
|
||||
// Set the SDP attributes and start Bluetooth advertising
|
||||
InitializeServiceSdpAttributes(rfcomm_provider_, service_name_);
|
||||
|
||||
Reference in New Issue
Block a user