1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-16 09:29:55 +00:00

Merge branch 'youre_outta_range_joe' into 'master'

FIX: check we're not going out of range while listing content files, fix #8029

Closes #8029

See merge request OpenMW/openmw!4201
This commit is contained in:
psi29a 2024-06-24 18:02:31 +00:00
commit cd365b4e8c

View file

@ -1,6 +1,7 @@
#include "contentmodel.hpp" #include "contentmodel.hpp"
#include "esmfile.hpp" #include "esmfile.hpp"
#include <algorithm>
#include <fstream> #include <fstream>
#include <memory> #include <memory>
#include <stdexcept> #include <stdexcept>
@ -672,9 +673,8 @@ void ContentSelectorModel::ContentModel::setNonUserContent(const QStringList& fi
for (auto* file : mFiles) for (auto* file : mFiles)
file->setFromAnotherConfigFile(mNonUserContent.contains(file->fileName().toLower())); file->setFromAnotherConfigFile(mNonUserContent.contains(file->fileName().toLower()));
int insertPosition = 0; auto insertPosition
while (mFiles.at(insertPosition)->builtIn()) = std::ranges::find_if(mFiles, [](const EsmFile* file) { return !file->builtIn(); }) - mFiles.begin();
++insertPosition;
for (const auto& filepath : fileList) for (const auto& filepath : fileList)
{ {