Account Settings: Fix crash for acocunts withour folder
authorOlivier Goffart <ogoffart@woboq.com>
Mon, 19 Oct 2015 16:08:11 +0000 (18:08 +0200)
committerOlivier Goffart <ogoffart@woboq.com>
Mon, 19 Oct 2015 16:08:11 +0000 (18:08 +0200)
Was broken by  027a865fbc1dbee52bb100e488c869383b1e92df

src/gui/accountsettings.cpp

index 2ef99f29305852f8256d474618eaaa39a44fc44d..8324de9784bca959a5aefb155dc9e97c07879d38 100644 (file)
@@ -519,18 +519,13 @@ AccountSettings::~AccountSettings()
 
 void AccountSettings::refreshSelectiveSyncStatus()
 {
-    if (_model->_folders.first()._subs.count() == 0) {
-        // Don't show when there is no items in model yet.
-        // It will be called again via rowsInserted()
-        ui->selectiveSyncStatus->setVisible(false);
-        return;
-    }
-
     bool shouldBeVisible = _model->isDirty();
     QStringList undecidedFolder;
     for (int i = 0; !shouldBeVisible && i < _model->rowCount(); ++i) {
-        if (ui->_folderList->isExpanded(_model->index(i)))
+        auto index = _model->index(i);
+        if (ui->_folderList->isExpanded(index) && _model->rowCount(index) > 0) {
             shouldBeVisible = true;
+        }
     }
 
     foreach (Folder *folder, FolderMan::instance()->map().values()) {