Skip to content

Commit

Permalink
COMMON: fixed reading ini files which have not value for key
Browse files Browse the repository at this point in the history
  • Loading branch information
voltya committed Aug 19, 2019
1 parent 073d833 commit c0db208
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions common/ini-file.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,12 +145,14 @@ bool INIFile::loadFromStream(SeekableReadStream &stream) {

// Split string at '=' into 'key' and 'value'. First, find the "=" delimeter.
const char *p = strchr(t, '=');
if (!p)
error("Config file buggy: Junk found in line line %d: '%s'", lineno, t);

// Extract the key/value pair
kv.key = String(t, p);
kv.value = String(p + 1);
if (!p) {
warning("Config file buggy: Junk found in line line %d: '%s'", lineno, t);
kv.key = String(t);
} else {
// Extract the key/value pair
kv.key = String(t, p);
kv.value = String(p + 1);
}

// Trim of spaces
kv.key.trim();
Expand Down

0 comments on commit c0db208

Please sign in to comment.