diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2020-02-10 12:44:51 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-10 12:44:51 +0100 |
commit | b390ad5a643c312034eb01aff3409e99b19d0046 (patch) | |
tree | b680c5b17122f26c8b152ac6abb8f52f98c90df2 | |
parent | 74a12ad95cf2276ad0e79df475a30eee880c8a3a (diff) | |
parent | 521da75380be712157fa172e27dda4dabba1de51 (diff) |
Merge pull request #36073 from RandomShaper/imvu/fix_variantparser_eof
Fix VariantParser::StreamString EOF determination
-rw-r--r-- | core/variant_parser.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/core/variant_parser.cpp b/core/variant_parser.cpp index 6ca9d6c246..4ce33b0123 100644 --- a/core/variant_parser.cpp +++ b/core/variant_parser.cpp @@ -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 { |