Skip to content

Commit d830c0a

Browse files
committed
Fix writeCommentBeforeValue() iter deref
fixes #649
1 parent 90591c7 commit d830c0a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/lib_json/json_writer.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -582,7 +582,7 @@ void StyledWriter::writeCommentBeforeValue(const Value& root) {
582582
while (iter != comment.end()) {
583583
document_ += *iter;
584584
if (*iter == '\n' &&
585-
(iter != comment.end() && *(iter + 1) == '/'))
585+
((iter+1) != comment.end() && *(iter + 1) == '/'))
586586
writeIndent();
587587
++iter;
588588
}
@@ -798,7 +798,7 @@ void StyledStreamWriter::writeCommentBeforeValue(const Value& root) {
798798
while (iter != comment.end()) {
799799
*document_ << *iter;
800800
if (*iter == '\n' &&
801-
(iter != comment.end() && *(iter + 1) == '/'))
801+
((iter+1) != comment.end() && *(iter + 1) == '/'))
802802
// writeIndent(); // would include newline
803803
*document_ << indentString_;
804804
++iter;
@@ -1086,7 +1086,7 @@ void BuiltStyledStreamWriter::writeCommentBeforeValue(Value const& root) {
10861086
while (iter != comment.end()) {
10871087
*sout_ << *iter;
10881088
if (*iter == '\n' &&
1089-
(iter != comment.end() && *(iter + 1) == '/'))
1089+
((iter+1) != comment.end() && *(iter + 1) == '/'))
10901090
// writeIndent(); // would write extra newline
10911091
*sout_ << indentString_;
10921092
++iter;

0 commit comments

Comments
 (0)