diff options
author | Oliver Wolff <oliver.wolff@qt.io> | 2020-03-24 10:09:27 +0100 |
---|---|---|
committer | Oliver Wolff <oliver.wolff@qt.io> | 2020-03-25 06:10:48 +0100 |
commit | 6c91ad8a7fe8adc555b57570486122f31f88d01b (patch) | |
tree | 06ffe85e08b9114a584731f47ebb335d594a68d7 | |
parent | b4282fd32ea06c1d634ea322f682a4c939a0cc89 (diff) | |
download | qtconnectivity-6c91ad8a7fe8adc555b57570486122f31f88d01b.tar.gz |
QLowEnergyControllerPrivateWinRT::connectToDevice: Return early if LE device cannot be found
If the host does not support BTLE, connectToDevice will fail and mDevice
will be zero. The return in this case was missing so that we tried to
access a null pointer and caused an exception.
(cherry picked from commit 280cfd43012d1cfbfcd26fe57f633db3fc13a379)
Change-Id: I24ea52b0d62c6e789c794fed8d75087fea7277b8
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
-rw-r--r-- | src/bluetooth/qlowenergycontroller_winrt.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/bluetooth/qlowenergycontroller_winrt.cpp b/src/bluetooth/qlowenergycontroller_winrt.cpp index f946b541..12ca9d10 100644 --- a/src/bluetooth/qlowenergycontroller_winrt.cpp +++ b/src/bluetooth/qlowenergycontroller_winrt.cpp @@ -325,6 +325,7 @@ void QLowEnergyControllerPrivateWinRT::connectToDevice() qCDebug(QT_BT_WINRT) << "Could not find LE device"; setError(QLowEnergyController::InvalidBluetoothAdapterError); setState(QLowEnergyController::UnconnectedState); + return; } BluetoothConnectionStatus status; hr = mDevice->get_ConnectionStatus(&status); |