From 280cfd43012d1cfbfcd26fe57f633db3fc13a379 Mon Sep 17 00:00:00 2001 From: Oliver Wolff Date: Tue, 24 Mar 2020 10:09:27 +0100 Subject: 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 --- src/bluetooth/qlowenergycontroller_winrt.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src/bluetooth') 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); -- cgit v1.2.3