fix(config): Allow empty values
This commit is contained in:
parent
d3bc1f938f
commit
0b949ee3bb
@ -107,17 +107,18 @@ void config::parse_file() {
|
||||
}
|
||||
|
||||
string key{forward<string>(string_util::trim(forward<string>(line.substr(0, equal_pos)), ' '))};
|
||||
string value{""};
|
||||
|
||||
auto it = m_sections[section].find(key);
|
||||
if (it != m_sections[section].end()) {
|
||||
throw key_error("Duplicate key name \"" + key + "\" defined on line " + to_string(lineno));
|
||||
}
|
||||
|
||||
if (line.size() > equal_pos + 1) {
|
||||
line.erase(0, equal_pos + 1);
|
||||
|
||||
if (equal_pos + 1 < line.size()) {
|
||||
value = string_util::trim(forward<string>(string_util::trim(line.substr(equal_pos + 1), ' ')), '"');
|
||||
}
|
||||
|
||||
string value{string_util::trim(forward<string>(string_util::trim(move(line), ' ')), '"')};
|
||||
m_sections[section].emplace_hint(it, move(key), move(value));
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user