mirror of https://github.com/akheron/jansson
Print correct error message on premature end of array
This commit is contained in:
parent
ae5ed3ff70
commit
dc9b954b62
|
@ -359,8 +359,10 @@ static json_t *json_parse_array(json_lex *lex, json_error_t *error)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
json_lex_scan(lex);
|
json_lex_scan(lex);
|
||||||
if(lex->token != ']') {
|
if(lex->token == ']')
|
||||||
while(1) {
|
return array;
|
||||||
|
|
||||||
|
while(lex->token) {
|
||||||
json_t *elem = json_parse(lex, error);
|
json_t *elem = json_parse(lex, error);
|
||||||
if(!elem)
|
if(!elem)
|
||||||
goto error;
|
goto error;
|
||||||
|
@ -376,7 +378,7 @@ static json_t *json_parse_array(json_lex *lex, json_error_t *error)
|
||||||
|
|
||||||
json_lex_scan(lex);
|
json_lex_scan(lex);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if(lex->token != ']') {
|
if(lex->token != ']') {
|
||||||
json_set_error(error, lex, "']' expected");
|
json_set_error(error, lex, "']' expected");
|
||||||
|
|
Loading…
Reference in New Issue