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-24 14:36:11 +0100 |
commit | 280cfd43012d1cfbfcd26fe57f633db3fc13a379 (patch) | |
tree | b174ae86d90c0fc7cb14f7727ae2f96d5abd6c55 | |
parent | 3a5eb0237b6f8e5a129ca6054f4a2704f89431ec (diff) | |
download | qtconnectivity-280cfd43012d1cfbfcd26fe57f633db3fc13a379.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.
Change-Id: Iba973f3980a2ecbb82d2cb6dd8d0f60a5bdf4890
Reviewed-by: Alex Blasche <alexander.blasche@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 ab566bd9..abe3392a 100644 --- a/src/bluetooth/qlowenergycontroller_winrt.cpp +++ b/src/bluetooth/qlowenergycontroller_winrt.cpp @@ -282,6 +282,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); |