@@ -417,12 +417,11 @@ namespace tao
417417 switch ( v->m_type ) {
418418 case json::type::ARRAY:
419419 {
420- const auto o = p;
421420 const auto t = internal::next_json_pointer_token ( ++p, e );
422421 if ( ( t.find_first_not_of ( " 0123456789" ) != std::string::npos ) || ( t.size () > 1 && t[ 0 ] == ' 0' ) ) {
423422 throw std::invalid_argument ( " unable to resolve json_pointer '" + k.value () + " ', "
424423 " invalid token for const array access '" + t + " ' "
425- " at '" + std::string ( k.value ().c_str (), o ) + ' \' ' );
424+ " at '" + std::string ( k.value ().c_str (), p - t. size () - 1 ) + ' \' ' );
426425 }
427426 v = &v->at ( std::stoull ( t ) );
428427 }
@@ -455,12 +454,11 @@ namespace tao
455454 switch ( v->m_type ) {
456455 case json::type::ARRAY:
457456 {
458- const auto o = p;
459457 const auto t = internal::next_json_pointer_token ( ++p, e );
460458 if ( t == " -" ) {
461459 if ( p != e ) {
462460 throw std::runtime_error ( " unable to resolve json_pointer '" + k.value () + " ' "
463- " at '" + std::string ( k.value ().c_str (), o ) + " ', "
461+ " at '" + std::string ( k.value ().c_str (), p - t. size () - 1 ) + " ', "
464462 " array access via '-'-token must occur as the last fragment" );
465463 }
466464 v->unsafe_emplace_back ( null );
@@ -469,7 +467,7 @@ namespace tao
469467 if ( ( t.find_first_not_of ( " 0123456789" ) != std::string::npos ) || ( t.size () > 1 && t[ 0 ] == ' 0' ) ) {
470468 throw std::invalid_argument ( " unable to resolve json_pointer '" + k.value () + " ', "
471469 " invalid token for array access '" + t + " ' "
472- " at '" + std::string ( k.value ().c_str (), o ) + ' \' ' );
470+ " at '" + std::string ( k.value ().c_str (), p - t. size () - 1 ) + ' \' ' );
473471 }
474472 v = &v->at ( std::stoull ( t ) );
475473 }
0 commit comments