summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Wassmuth <c.wassmuth@oculus.de>2019-03-05 12:53:19 +0100
committerChristian WaƟmuth <c.wassmuth@oculus.de>2019-03-05 13:11:38 +0000
commit3f9ba9c07322d90f8f918d9e144e84d422e4cfbd (patch)
treebf1115facbaec6ee5f5b135dbc82dca4ff9b594b
parent1b19d7981610c2a9587544da654b4ca783e1bf6b (diff)
Bluez-DBus: Fix crash at calling disconnect while not connected
Calling disconnectFromDevice() while not connected or in ClosingState caused a crash on accessing device which is null. [ChangeLog][QtBluetooth][Bluez-DBus] Fix crash at calling QLowEnergyController::disconnectFromDevice while not connected Change-Id: I5979e3e5fca62c4a1469014e4f553c7db24f8dac Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
-rw-r--r--src/bluetooth/qlowenergycontroller_bluezdbus.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/bluetooth/qlowenergycontroller_bluezdbus.cpp b/src/bluetooth/qlowenergycontroller_bluezdbus.cpp
index 441eca6b..f019d9c2 100644
--- a/src/bluetooth/qlowenergycontroller_bluezdbus.cpp
+++ b/src/bluetooth/qlowenergycontroller_bluezdbus.cpp
@@ -350,6 +350,9 @@ void QLowEnergyControllerPrivateBluezDBus::connectToDevice()
void QLowEnergyControllerPrivateBluezDBus::disconnectFromDevice()
{
+ if (!device)
+ return;
+
setState(QLowEnergyController::ClosingState);
QDBusPendingReply<> reply = device->Disconnect();