Fix JSON parsing bug when a backslash was at the very end of a string

This commit is contained in:
Thulinma 2020-03-12 15:32:24 +01:00
parent 35e3fb4bca
commit 0f12e107de

View file

@ -178,7 +178,7 @@ static std::string read_string(char separator, std::istream &fromstream){
while (fromstream.good()){
char c;
fromstream.get(c);
if (c == '\\'){
if (!escaped && c == '\\'){
escaped = true;
continue;
}
@ -189,6 +189,7 @@ static std::string read_string(char separator, std::istream &fromstream){
}
switch (c){
case 'b': out += '\b'; break;
case '\\': out += '\\'; break;
case 'f': out += '\f'; break;
case 'n': out += '\n'; break;
case 'r': out += '\r'; break;