Commit c9c11514 authored by David Rosca's avatar David Rosca
Browse files

Check adapter for nullptr in interfacesAdded/interfacesRemoved slots

BUG: 340577
parent e7bb4e3b
......@@ -143,8 +143,10 @@ void ManagerPrivate::_k_interfacesAdded(const QDBusObjectPath &objectPath, const
} else if(i.key() == "org.bluez.Device1") {
QString adapterPath = i.value().value("Adapter").value<QDBusObjectPath>().path();
Adapter * const adapter = m_adapters.value(adapterPath);
adapter->addDevice(objectPath.path());
m_devAdapter.insert(objectPath.path(),adapter);
if (adapter) {
adapter->addDevice(objectPath.path());
m_devAdapter.insert(objectPath.path(),adapter);
}
}
}
}
......@@ -176,7 +178,9 @@ void ManagerPrivate::_k_interfacesRemoved(const QDBusObjectPath &objectPath, con
}
} else if(interface == "org.bluez.Device1") {
Adapter * const adapter = m_devAdapter.take(object);
adapter->removeDevice(object);
if (adapter) {
adapter->removeDevice(object);
}
}
}
}
......@@ -207,4 +211,4 @@ void ManagerPrivate::_k_bluezAdapterPoweredChanged(bool powered)
}
#include "bluedevilmanager_p.moc"
\ No newline at end of file
#include "bluedevilmanager_p.moc"
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment