diff options
Diffstat (limited to 'examples/bluetooth/lowenergyscanner/device.cpp')
-rw-r--r-- | examples/bluetooth/lowenergyscanner/device.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/examples/bluetooth/lowenergyscanner/device.cpp b/examples/bluetooth/lowenergyscanner/device.cpp index 82179db1..d860457e 100644 --- a/examples/bluetooth/lowenergyscanner/device.cpp +++ b/examples/bluetooth/lowenergyscanner/device.cpp @@ -152,12 +152,12 @@ void Device::scanServices(const QString &address) // We need the current device for service discovery. for (auto d: qAsConst(devices)) { - auto device = qobject_cast<DeviceInfo *>(d); - if (!device) - continue; - - if (device->getAddress() == address ) - currentDevice.setDevice(device->getDevice()); + if (auto device = qobject_cast<DeviceInfo *>(d)) { + if (device->getAddress() == address ) { + currentDevice.setDevice(device->getDevice()); + break; + } + } } if (!currentDevice.getDevice().isValid()) { |