From 0eaa5e3f1bb51756caadd35b3590330354d176f2 Mon Sep 17 00:00:00 2001 From: Benoit Blanchon Date: Thu, 27 Feb 2014 13:12:10 +0100 Subject: [PATCH] Fixed null pointer exception in JsonArray and JsonHashTable constructors --- JsonArray.cpp | 2 +- JsonHashTable.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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(); }