From 1e69400369f6878a96dc1619b3003a5e030f3d4e Mon Sep 17 00:00:00 2001 From: wangyuan21 Date: Mon, 25 Oct 2021 18:22:21 +0800 Subject: [PATCH] Apply CR suggestions --- src/lib_json/json_value.cpp | 2 +- src/test_lib_json/main.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lib_json/json_value.cpp b/src/lib_json/json_value.cpp index cf32096..e234477 100644 --- a/src/lib_json/json_value.cpp +++ b/src/lib_json/json_value.cpp @@ -1530,7 +1530,7 @@ void Path::makePath(const String& path, const InArgs& in) { while (current != end) { if (*current == '[') { ++current; - if (*current == '%') { + if (current != end && *current == '%') { addPathInArg(path, in, itInArg, PathArgument::kindIndex); ++current; } else { diff --git a/src/test_lib_json/main.cpp b/src/test_lib_json/main.cpp index 884f0ec..07b9a5b 100644 --- a/src/test_lib_json/main.cpp +++ b/src/test_lib_json/main.cpp @@ -2140,8 +2140,8 @@ JSONTEST_FIXTURE_LOCAL(ValueTest, searchValueByPath) { const Json::String expected("{" "\"property1\":[0,1,null]," "\"property2\":{" - "\"hello\":null," - "\"object\":\"object\"}," + "\"hello\":null," + "\"object\":\"object\"}," "\"property3\":[[0,1,null],[2,3]]" "}\n"); Json::Path path1(".property1.[%]", 2);