summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/bluetooth/qbluetoothservicediscoveryagent.cpp3
-rw-r--r--src/imports/bluetooth/qdeclarativebluetoothdiscoverymodel.cpp5
2 files changed, 5 insertions, 3 deletions
diff --git a/src/bluetooth/qbluetoothservicediscoveryagent.cpp b/src/bluetooth/qbluetoothservicediscoveryagent.cpp
index 87ccb108..beaa3503 100644
--- a/src/bluetooth/qbluetoothservicediscoveryagent.cpp
+++ b/src/bluetooth/qbluetoothservicediscoveryagent.cpp
@@ -266,6 +266,9 @@ void QBluetoothServiceDiscoveryAgent::stop()
{
Q_D(QBluetoothServiceDiscoveryAgent);
+ if (!isActive())
+ return;
+
switch (d->discoveryState()) {
case QBluetoothServiceDiscoveryAgentPrivate::DeviceDiscovery:
d->stopDeviceDiscovery();
diff --git a/src/imports/bluetooth/qdeclarativebluetoothdiscoverymodel.cpp b/src/imports/bluetooth/qdeclarativebluetoothdiscoverymodel.cpp
index 6689d663..b7534329 100644
--- a/src/imports/bluetooth/qdeclarativebluetoothdiscoverymodel.cpp
+++ b/src/imports/bluetooth/qdeclarativebluetoothdiscoverymodel.cpp
@@ -367,11 +367,10 @@ void QDeclarativeBluetoothDiscoveryModel::setRunning(bool running)
d->m_running = running;
if (!running) {
- if (d->m_deviceAgent) {
+ if (d->m_deviceAgent)
d->m_deviceAgent->stop();
- } else if (d->m_serviceAgent) {
+ if (d->m_serviceAgent)
d->m_serviceAgent->stop();
- }
} else {
clearModel();
d->m_error = NoError;