@@ -1504,12 +1504,12 @@ void Path::makePath(const JSONCPP_STRING& path, const InArgs& in) {
15041504 index = index * 10 + ArrayIndex (*current - ' 0' );
15051505 args_.push_back (index);
15061506 }
1507- if (current == end || *current++ != ' ]' )
1507+ if (current == end || *++current != ' ]' )
15081508 invalidPath (path, int (current - path.c_str ()));
15091509 } else if (*current == ' %' ) {
15101510 addPathInArg (path, in, itInArg, PathArgument::kindKey);
15111511 ++current;
1512- } else if (*current == ' .' ) {
1512+ } else if (*current == ' .' || *current == ' ] ' ) {
15131513 ++current;
15141514 } else {
15151515 const char * beginName = current;
@@ -1529,7 +1529,7 @@ void Path::addPathInArg(const JSONCPP_STRING& /*path*/,
15291529 } else if ((*itInArg)->kind_ != kind) {
15301530 // Error: bad argument type
15311531 } else {
1532- args_.push_back (**itInArg);
1532+ args_.push_back (**itInArg++ );
15331533 }
15341534}
15351535
@@ -1544,16 +1544,19 @@ const Value& Path::resolve(const Value& root) const {
15441544 if (arg.kind_ == PathArgument::kindIndex) {
15451545 if (!node->isArray () || !node->isValidIndex (arg.index_ )) {
15461546 // Error: unable to resolve path (array value expected at position...
1547+ return Value::null;
15471548 }
15481549 node = &((*node)[arg.index_ ]);
15491550 } else if (arg.kind_ == PathArgument::kindKey) {
15501551 if (!node->isObject ()) {
15511552 // Error: unable to resolve path (object value expected at position...)
1553+ return Value::null;
15521554 }
15531555 node = &((*node)[arg.key_ ]);
15541556 if (node == &Value::nullSingleton ()) {
15551557 // Error: unable to resolve path (object has no member named '' at
15561558 // position...)
1559+ return Value::null;
15571560 }
15581561 }
15591562 }
0 commit comments