Don't try to initialize the devices model with an empty list

This commit is contained in:
Aleix Pol 2015-03-14 04:28:06 +01:00
parent fb9143a2aa
commit bb97cc19b6

View file

@ -146,6 +146,10 @@ void DevicesModel::receivedDeviceList(QDBusPendingCallWatcher* watcher)
Q_ASSERT(m_deviceList.isEmpty()); Q_ASSERT(m_deviceList.isEmpty());
const QStringList deviceIds = pendingDeviceIds.value(); const QStringList deviceIds = pendingDeviceIds.value();
if (deviceIds.isEmpty())
return;
beginInsertRows(QModelIndex(), 0, deviceIds.count()-1); beginInsertRows(QModelIndex(), 0, deviceIds.count()-1);
Q_FOREACH(const QString& id, deviceIds) { Q_FOREACH(const QString& id, deviceIds) {
m_deviceList.append(new DeviceDbusInterface(id, this)); m_deviceList.append(new DeviceDbusInterface(id, this));