diff --git a/src/components/config.cpp b/src/components/config.cpp index 2613c733..6f5bd729 100644 --- a/src/components/config.cpp +++ b/src/components/config.cpp @@ -107,17 +107,18 @@ void config::parse_file() { } string key{forward(string_util::trim(forward(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_util::trim(line.substr(equal_pos + 1), ' ')), '"'); } - string value{string_util::trim(forward(string_util::trim(move(line), ' ')), '"')}; m_sections[section].emplace_hint(it, move(key), move(value)); }