Fixed null pointer exception in JsonArray and JsonHashTable constructors

This commit is contained in:
Benoit Blanchon
2014-02-27 13:12:10 +01:00
parent b35095ded1
commit 0eaa5e3f1b
2 changed files with 2 additions and 2 deletions

View File

@ -9,7 +9,7 @@
JsonArray::JsonArray(char* json, jsmntok_t* tokens)
: JsonObjectBase(json, tokens)
{
if (tokens[0].type != JSMN_ARRAY)
if (tokens == 0 || tokens[0].type != JSMN_ARRAY)
makeInvalid();
}

View File

@ -11,7 +11,7 @@
JsonHashTable::JsonHashTable(char* json, jsmntok_t* tokens)
: JsonObjectBase(json, tokens)
{
if (tokens[0].type != JSMN_OBJECT)
if (tokens == 0 || tokens[0].type != JSMN_OBJECT)
makeInvalid();
}