on xenial help sign in
protect us against crashes if the backend emits signals for apps we don't know
commitd7f22acd9b05edffa8bdf0095884005ebcc9f70c authorMichael Zanetti <michael.zanetti@canonical.com> dateThu 22 Aug 2013, 15:03 (13 years ago) parent1c0c70d
1 file changed+10−6
plugins/Unity/Launcher/launchermodel.cpp+10−6
plugins/Unity/Launcher/launchermodel.cpp+10−6
@@ -209,16 +209,20 @@ int LauncherModel::findApplication(const QString &appId)
209209void LauncherModel::progressChanged(const QString &appId, int progress)
210210{
211211 int idx = findApplication(appId);
212− LauncherItem *item = m_list.at(idx);
213− item->setProgress(progress);
214− Q_EMIT dataChanged(index(idx), index(idx), QVector<int>() << RoleProgress);
212+ if (idx >= 0) {
213+ LauncherItem *item = m_list.at(idx);
214+ item->setProgress(progress);
215+ Q_EMIT dataChanged(index(idx), index(idx), QVector<int>() << RoleProgress);
216+ }
215217}
216218
217219
218220void LauncherModel::countChanged(const QString &appId, int count)
219221{
220222 int idx = findApplication(appId);
221− LauncherItem *item = m_list.at(idx);
222− item->setCount(count);
223− Q_EMIT dataChanged(index(idx), index(idx), QVector<int>() << RoleCount);
223+ if (idx >= 0) {
224+ LauncherItem *item = m_list.at(idx);
225+ item->setCount(count);
226+ Q_EMIT dataChanged(index(idx), index(idx), QVector<int>() << RoleCount);
227+ }
224228}