Merge pull request #36073 from RandomShaper/imvu/fix_variantparser_eof

Fix VariantParser::StreamString EOF determination
This commit is contained in:
Rémi Verschelde 2020-02-10 12:44:51 +01:00 committed by GitHub
commit b390ad5a64
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -51,10 +51,16 @@ bool VariantParser::StreamFile::is_eof() const {
CharType VariantParser::StreamString::get_char() {
if (pos >= s.length())
if (pos > s.length()) {
return 0;
else
} else if (pos == s.length()) {
// You need to try to read again when you have reached the end for EOF to be reported,
// so this works the same as files (like StreamFile does)
pos++;
return 0;
} else {
return s[pos++];
}
}
bool VariantParser::StreamString::is_utf8() const {