summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorOliver Wolff <oliver.wolff@qt.io>2017-11-03 13:04:31 +0100
committerOliver Wolff <oliver.wolff@qt.io>2017-11-03 13:10:58 +0000
commitca6b84af1612440a925b4a8223cbed4beb9ac33e (patch)
tree9542e2f466b90bcd6e9c1d8105649fb4389822f2 /src
parent2a5f325733fa43961d785bf9a0d5c209bd8c5c76 (diff)
winrt: Do not assert when registering a service without a local BT adapter
If no bluetooth adapter is present in the system IRfCommServiceProvider::CreateAsync will result in "device not available". In this case we should not assert, but just handle that as a failed attempt to register the service. Task-number: QTBUG-64118 Change-Id: I73591a1f2dbedc798824e5afef53a9e2d793e73e Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/bluetooth/qbluetoothserviceinfo_winrt.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/bluetooth/qbluetoothserviceinfo_winrt.cpp b/src/bluetooth/qbluetoothserviceinfo_winrt.cpp
index d72056b7..d1a97b6d 100644
--- a/src/bluetooth/qbluetoothserviceinfo_winrt.cpp
+++ b/src/bluetooth/qbluetoothserviceinfo_winrt.cpp
@@ -337,7 +337,12 @@ bool QBluetoothServiceInfoPrivate::registerService(const QBluetoothAddress &loca
hr = providerStatics->CreateAsync(serviceId.Get(), &op);
Q_ASSERT_SUCCEEDED(hr);
hr = QWinRTFunctions::await(op, serviceProvider.GetAddressOf());
- Q_ASSERT_SUCCEEDED(hr);
+ if (hr == HRESULT_FROM_WIN32(ERROR_DEVICE_NOT_AVAILABLE)) {
+ qCWarning(QT_BT_WINRT) << Q_FUNC_INFO << "No bluetooth adapter available.";
+ return false;
+ } else {
+ Q_ASSERT_SUCCEEDED(hr);
+ }
ComPtr<IStreamSocketListener> listener = sPriv->listener();
if (!listener) {