Reject extra chars if strictRoot

resolves #511
This commit is contained in:
Christopher Dunn 2016-08-21 20:32:16 -05:00
parent 094a7d8564
commit 126bdc2b05

View File

@ -1068,7 +1068,7 @@ bool OurReader::parse(const char* beginDoc,
Token token;
skipCommentTokens(token);
if (features_.failIfExtra_) {
if (token.type_ != tokenError && token.type_ != tokenEndOfStream) {
if ((features_.strictRoot_ || token.type_ != tokenError) && token.type_ != tokenEndOfStream) {
addError("Extra non-whitespace after JSON value.", token);
return false;
}