Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
jihuayu committed Nov 17, 2023
1 parent 7fb2d96 commit ce8e241
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/types/json.h
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,9 @@ struct JsonValue {
value, path, [&insert_values, &result_count, index](const std::string & /*path*/, jsoncons::json &val) {
if (val.is_array()) {
auto len = static_cast<int64_t>(val.size());
if (index >= len /*index > 0*/ || len + index < 0 /*index < 0*/) {
// When index > 0, we need index < len
// when index < 0, we need index >= -len.
if (index >= len || index < -len) {
result_count.emplace_back(std::nullopt);
return;
}
Expand Down

0 comments on commit ce8e241

Please sign in to comment.