fix: 修复反复开关蓝牙导致的崩溃问题

野指针问题

Log: 修复反复开关蓝牙导致的崩溃问题
Influence: 蓝牙开关功能
Task: https://pms.uniontech.com/task-view-226123.html
Change-Id: Id6c495ffa24aebbb15ad0bac8cdc5ed9aeef8f54
This commit is contained in:
范朋程 2022-12-13 17:15:49 +08:00
parent 460705c401
commit 949c9eb9af

View File

@ -274,7 +274,7 @@ void BluetoothAdapterItem::onDeviceAdded(const Device *device)
void BluetoothAdapterItem::onDeviceRemoved(const Device *device)
{
if (m_deviceItems.isEmpty())
if (m_deviceItems.isEmpty() || !m_deviceItems.keys().contains(device->id()))
return;
m_deviceModel->removeRow(m_deviceItems.value(device->id())->standardItem()->row());