mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-17 13:07:54 +02:00
util: fix argsman dupe key error
fixes #22638
If we find a duplicate key and error, clear `values` before returning so that
WriteSettings will write an empty file, therefore clearing it.
This aligns with GUI behaviour added in 1ee6d0b.
This commit is contained in:
parent
f7bdcfc83f
commit
8fcbdadfad
2 changed files with 4 additions and 1 deletions
|
|
@ -99,6 +99,8 @@ bool ReadSettings(const fs::path& path, std::map<std::string, SettingsValue>& va
|
|||
auto inserted = values.emplace(in_keys[i], in_values[i]);
|
||||
if (!inserted.second) {
|
||||
errors.emplace_back(strprintf("Found duplicate key %s in settings file %s", in_keys[i], fs::PathToString(path)));
|
||||
values.clear();
|
||||
break;
|
||||
}
|
||||
}
|
||||
return errors.empty();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue