diff --git a/src/lib_json/json_value.cpp b/src/lib_json/json_value.cpp index 0dfd6f3..810b06c 100644 --- a/src/lib_json/json_value.cpp +++ b/src/lib_json/json_value.cpp @@ -1398,11 +1398,11 @@ String Value::Comments::get(CommentPlacement slot) const { } void Value::Comments::set(CommentPlacement slot, String comment) { + if (slot >= CommentPlacement::numberOfCommentPlacement) { + return; + } if (!ptr_) { ptr_ = std::unique_ptr(new Array()); - } - - if (slot < CommentPlacement::numberOfCommentPlacement) { (*ptr_)[slot] = std::move(comment); } }