Change the check for duplicate keys when writing the options file to an assertion as it can't actually happen
Originally committed to SVN as r6013.
This commit is contained in:
parent
4823706206
commit
56165305a4
1 changed files with 1 additions and 6 deletions
|
@ -207,12 +207,7 @@ void Options::Flush() {
|
||||||
bool Options::PutOption(json::Object &obj, const std::string &path, const json::UnknownElement &value) {
|
bool Options::PutOption(json::Object &obj, const std::string &path, const json::UnknownElement &value) {
|
||||||
// Having a '/' denotes it is a leaf.
|
// Having a '/' denotes it is a leaf.
|
||||||
if (path.find('/') == std::string::npos) {
|
if (path.find('/') == std::string::npos) {
|
||||||
json::Object::iterator pos = obj.find(path);
|
assert(obj.find(path) == obj.end());
|
||||||
|
|
||||||
// Fail if a key of the same name already exists.
|
|
||||||
if (pos != obj.end())
|
|
||||||
throw OptionErrorDuplicateKey("Key already exists");
|
|
||||||
|
|
||||||
obj[path] = value;
|
obj[path] = value;
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue