mirror of
https://github.com/OpenMW/openmw.git
synced 2025-02-19 12:09:42 +00:00
Handle possible invalid iterator issue during settings parsing
This commit is contained in:
parent
3e20f36953
commit
71227ffc04
1 changed files with 3 additions and 0 deletions
|
@ -338,6 +338,9 @@ bool Config::GameSettings::writeFileWithComments(QFile &file)
|
||||||
if (!comments.empty() && index != -1 && settingRegex.captureCount() >= 2 &&
|
if (!comments.empty() && index != -1 && settingRegex.captureCount() >= 2 &&
|
||||||
mUserSettings.find(settingRegex.cap(1)) != mUserSettings.end())
|
mUserSettings.find(settingRegex.cap(1)) != mUserSettings.end())
|
||||||
{
|
{
|
||||||
|
if (commentStart == fileCopy.end())
|
||||||
|
throw std::runtime_error("Config::GameSettings: failed to parse settings - iterator is past of end of settings file");
|
||||||
|
|
||||||
for (std::vector<QString>::const_iterator it = comments.begin(); it != comments.end(); ++it)
|
for (std::vector<QString>::const_iterator it = comments.begin(); it != comments.end(); ++it)
|
||||||
{
|
{
|
||||||
*commentStart = *it;
|
*commentStart = *it;
|
||||||
|
|
Loading…
Reference in a new issue