diff --git a/src/lib_json/json_value.cpp b/src/lib_json/json_value.cpp index 810b06c..26887f6 100644 --- a/src/lib_json/json_value.cpp +++ b/src/lib_json/json_value.cpp @@ -1398,11 +1398,10 @@ 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); } }