mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-16 03:29:55 +00:00
Gracefully handle content lists that specify duplicate BSAs
Previously, if fed bad data, or a content list predated a BSA being moved to a non-user config file, or possibly in other situations (but not any of the obvious ones as those had other guards), the `selectedArchives` list could be longer than the number of archives available due to duplicate entries. This ensures they're handled like entries specifying no-longer-present archives, and just skips the duplicates. The same would happen elsewhere in similar situations, but those code paths aren't always taken.
This commit is contained in:
parent
cdf7bd74d5
commit
0537b53d21
1 changed files with 3 additions and 0 deletions
|
@ -398,6 +398,9 @@ void Launcher::DataFilesPage::populateFileViews(const QString& contentModelName)
|
||||||
continue;
|
continue;
|
||||||
const auto name = match[0]->text();
|
const auto name = match[0]->text();
|
||||||
const auto oldrow = ui.archiveListWidget->row(match[0]);
|
const auto oldrow = ui.archiveListWidget->row(match[0]);
|
||||||
|
// entries may be duplicated, e.g. if a content list predated a BSA being added to a non-user config file
|
||||||
|
if (oldrow < row)
|
||||||
|
continue;
|
||||||
ui.archiveListWidget->takeItem(oldrow);
|
ui.archiveListWidget->takeItem(oldrow);
|
||||||
ui.archiveListWidget->insertItem(row, name);
|
ui.archiveListWidget->insertItem(row, name);
|
||||||
ui.archiveListWidget->item(row)->setCheckState(Qt::Checked);
|
ui.archiveListWidget->item(row)->setCheckState(Qt::Checked);
|
||||||
|
|
Loading…
Reference in a new issue