Skip to content

Commit 2dbffe5

Browse files
committed
Ignore empty comments in input.
Empty comments (// or /***/) are unnecessary if present in json input. Current patch ignores empty comments.
1 parent fe855fb commit 2dbffe5

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/lib_json/json_value.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,8 @@ void Value::CommentInfo::setComment(const char* text, size_t len) {
150150
JSON_ASSERT_MESSAGE(
151151
text[0] == '\0' || text[0] == '/',
152152
"in Json::Value::setComment(): Comments must start with /");
153-
// It seems that /**/ style comments are acceptable as well.
153+
// It seems that /**/ style comments are acceptable as well.But ignore empty comments, these are unnecessary.
154+
if((text[2] == '\n' || !strcmp(text+2,"*/"))) return;
154155
comment_ = duplicateStringValue(text, len);
155156
}
156157

0 commit comments

Comments
 (0)