Skip to content

Commit

Permalink
Fix writeCommentBeforeValue() iter deref
Browse files Browse the repository at this point in the history
fixes #649
  • Loading branch information
cdunn2001 committed Aug 28, 2017
1 parent 90591c7 commit d830c0a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/lib_json/json_writer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit d830c0a

Please sign in to comment.