diff options
author | Andrei Prykhodko | 2019-08-19 14:04:21 +0300 |
---|---|---|
committer | Filippos Karapetis | 2019-08-19 21:50:14 +0300 |
commit | f52a96e1f4d2ac3abbdb4d47b7cecfab761db1db (patch) | |
tree | d62b15e8a784ca25fde8090213dfcb43daec25c4 /common | |
parent | 1173344918eb7330b3010bb0ea7f872446df0b16 (diff) | |
download | scummvm-rg350-f52a96e1f4d2ac3abbdb4d47b7cecfab761db1db.tar.gz scummvm-rg350-f52a96e1f4d2ac3abbdb4d47b7cecfab761db1db.tar.bz2 scummvm-rg350-f52a96e1f4d2ac3abbdb4d47b7cecfab761db1db.zip |
COMMON: fixed reading ini files which have not value for key
Diffstat (limited to 'common')
-rw-r--r-- | common/ini-file.cpp | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/common/ini-file.cpp b/common/ini-file.cpp index 1bf0a0eec6..d35c1e8d16 100644 --- a/common/ini-file.cpp +++ b/common/ini-file.cpp @@ -145,12 +145,15 @@ 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); + kv.value.clear(); + } else { + // Extract the key/value pair + kv.key = String(t, p); + kv.value = String(p + 1); + } // Trim of spaces kv.key.trim(); |