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