We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 1ee39a6 commit 94cda30Copy full SHA for 94cda30
src/lib_json/json_value.cpp
@@ -1398,13 +1398,11 @@ String Value::Comments::get(CommentPlacement slot) const {
1398
}
1399
1400
void Value::Comments::set(CommentPlacement slot, String comment) {
1401
- if (!ptr_) {
+ if (slot >= CommentPlacement::numberOfCommentPlacement)
1402
+ return;
1403
+ if (!ptr_)
1404
ptr_ = std::unique_ptr<Array>(new Array());
- }
- // check comments array boundry.
1405
- if (slot < CommentPlacement::numberOfCommentPlacement) {
1406
- (*ptr_)[slot] = std::move(comment);
1407
+ (*ptr_)[slot] = std::move(comment);
1408
1409
1410
void Value::setComment(String comment, CommentPlacement placement) {
0 commit comments