I call this code on the startup of the application, but if I call it again, it crashes without any errors.
Qt Code:
void MCM::repopWList() { mcDir.cd("saves"); backupsDir.cd("MCM/backups"); ui->worldList->clear(); //list the worlds QFileInfoList mcDirList = mcDir.entryInfoList(); for (int i = 0; i < mcDirList.size(); i++) { ui->worldList->addItem(fileInfo.fileName()); } QFileInfoList backupsDirList = backupsDir.entryInfoList(); for (int i = 0; i < backupsDirList.size(); i++) { bool wExist = false; for (int j = 0; j < ui->worldList->count(); j++) { string itemText = ui->worldList->item(j)->text().toStdString(); if (itemText == backupInfo.fileName().toStdString()) { wExist = true; } } if (wExist == false) { ui->worldList->addItem(newWorld); } } }To copy to clipboard, switch view to plain text mode
Bookmarks