Simplify contains + get value
This commit is contained in:
parent
1e9a0f6808
commit
f7e86ed131
1 changed files with 3 additions and 3 deletions
|
@ -212,9 +212,9 @@ void Daemon::onNewDeviceLink(const NetworkPacket& identityPacket, DeviceLink* dl
|
|||
|
||||
//qCDebug(KDECONNECT_CORE) << "Device discovered" << id << "via" << dl->provider()->name();
|
||||
|
||||
if (d->m_devices.contains(id)) {
|
||||
Device* device = d->m_devices.value(id, nullptr);
|
||||
if (device) {
|
||||
qCDebug(KDECONNECT_CORE) << "It is a known device" << identityPacket.get<QString>(QStringLiteral("deviceName"));
|
||||
Device* device = d->m_devices[id];
|
||||
bool wasReachable = device->isReachable();
|
||||
device->addLink(identityPacket, dl);
|
||||
if (!wasReachable) {
|
||||
|
@ -223,7 +223,7 @@ void Daemon::onNewDeviceLink(const NetworkPacket& identityPacket, DeviceLink* dl
|
|||
}
|
||||
} else {
|
||||
qCDebug(KDECONNECT_CORE) << "It is a new device" << identityPacket.get<QString>(QStringLiteral("deviceName"));
|
||||
Device* device = new Device(this, identityPacket, dl);
|
||||
device = new Device(this, identityPacket, dl);
|
||||
|
||||
//we discard the connections that we created but it's not paired.
|
||||
if (!isDiscoveringDevices() && !device->isTrusted() && !dl->linkShouldBeKeptAlive()) {
|
||||
|
|
Loading…
Reference in a new issue