Update json_value.cpp

This commit is contained in:
Sun Yiming Z 2021-03-18 11:45:43 +08:00 committed by GitHub
parent 3345a5cf86
commit 8780fb07c7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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<Array>(new Array());
}
if (slot < CommentPlacement::numberOfCommentPlacement) {
(*ptr_)[slot] = std::move(comment);
}
}