Fixed bug JsonObjectBase::getNestedTokenCount() that reads uninitialized token

This commit is contained in:
Benoit Blanchon
2014-07-14 15:52:26 +02:00
parent 39c185ae67
commit ccb97fc6e0

View File

@ -10,15 +10,15 @@ using namespace ArduinoJson::Parser;
int JsonObjectBase::getNestedTokenCount(jsmntok_t* token)
{
int end = token->end;
int tokensToVisit = token->size;
int count = 0;
token++;
while (token->start < end)
while (tokensToVisit)
{
token++;
count++;
token++;
tokensToVisit--;
tokensToVisit += token->size;
}
return count;