From d830c0ab94d8ed9c254e1505e6e4e02097f424bc Mon Sep 17 00:00:00 2001 From: Christopher Dunn Date: Mon, 28 Aug 2017 08:42:20 -0500 Subject: [PATCH] Fix writeCommentBeforeValue() iter deref fixes #649 --- src/lib_json/json_writer.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lib_json/json_writer.cpp b/src/lib_json/json_writer.cpp index 02f1cb1..802f96c 100644 --- a/src/lib_json/json_writer.cpp +++ b/src/lib_json/json_writer.cpp @@ -582,7 +582,7 @@ void StyledWriter::writeCommentBeforeValue(const Value& root) { while (iter != comment.end()) { document_ += *iter; if (*iter == '\n' && - (iter != comment.end() && *(iter + 1) == '/')) + ((iter+1) != comment.end() && *(iter + 1) == '/')) writeIndent(); ++iter; } @@ -798,7 +798,7 @@ void StyledStreamWriter::writeCommentBeforeValue(const Value& root) { while (iter != comment.end()) { *document_ << *iter; if (*iter == '\n' && - (iter != comment.end() && *(iter + 1) == '/')) + ((iter+1) != comment.end() && *(iter + 1) == '/')) // writeIndent(); // would include newline *document_ << indentString_; ++iter; @@ -1086,7 +1086,7 @@ void BuiltStyledStreamWriter::writeCommentBeforeValue(Value const& root) { while (iter != comment.end()) { *sout_ << *iter; if (*iter == '\n' && - (iter != comment.end() && *(iter + 1) == '/')) + ((iter+1) != comment.end() && *(iter + 1) == '/')) // writeIndent(); // would write extra newline *sout_ << indentString_; ++iter;