diff --git a/JsonArray.cpp b/JsonArray.cpp index f2e1bfae..8a071f6c 100644 --- a/JsonArray.cpp +++ b/JsonArray.cpp @@ -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(); } diff --git a/JsonHashTable.cpp b/JsonHashTable.cpp index ee7bc0c2..1e1e0c6b 100644 --- a/JsonHashTable.cpp +++ b/JsonHashTable.cpp @@ -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(); }