Add check if applist rowCount() already empty to prevent assert exception
authorDominique Fuchs <32204802+DominiqueFuchs@users.noreply.github.com>
Thu, 16 Jan 2020 10:30:51 +0000 (11:30 +0100)
committerDominique Fuchs <32204802+DominiqueFuchs@users.noreply.github.com>
Thu, 16 Jan 2020 10:30:51 +0000 (11:30 +0100)
Signed-off-by: Dominique Fuchs <32204802+DominiqueFuchs@users.noreply.github.com>
src/gui/tray/UserModel.cpp

index 08b679e51b67ac213745b8c77921e3b79c0e53e5..ae9b42653f58782b3a17f94478ca59b6d7e92e58 100644 (file)
@@ -779,9 +779,11 @@ UserAppsModel::UserAppsModel(QObject *parent)
 
 void UserAppsModel::buildAppList()
 {
-    beginRemoveRows(QModelIndex(), 0, rowCount());
-    _apps.clear();
-    endRemoveRows();
+    if (rowCount() > 0) {
+        beginRemoveRows(QModelIndex(), 0, rowCount() - 1);
+        _apps.clear();
+        endRemoveRows();
+    }
 
     if(UserModel::instance()->appList().count() > 0) {
         foreach(AccountApp *app, UserModel::instance()->appList()) {