Commit af02ca7c authored by Albert Vaca Cintora's avatar Albert Vaca Cintora

Check when empty to avoid a crash

parent fc3e2eff
......@@ -62,9 +62,11 @@ void DevicesModel::deviceAdded(const QString& id)
//Full refresh
Q_UNUSED(id);
beginRemoveRows(QModelIndex(), 0, m_deviceList.count() - 1);
m_deviceList.clear();
endRemoveRows();
if (m_deviceList.count() > 0) {
beginRemoveRows(QModelIndex(), 0, m_deviceList.count() - 1);
m_deviceList.clear();
endRemoveRows();
}
QList<QString> deviceIds = m_dbusInterface->devices();
Q_FOREACH(const QString& id, deviceIds) {
beginInsertRows(QModelIndex(), rowCount(), rowCount() + 1);
......
Markdown is supported
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