limit allowed types for JSON Query

limited allowed types for JSON::Query to Object, Array, Object::Ptr,
Array::Ptr and empty
This commit is contained in:
Aleksandar Fabijanic
2013-06-07 23:37:02 -05:00
parent 5e6ef1c14d
commit b61b5ae53d
4 changed files with 19 additions and 2 deletions

View File

@@ -50,6 +50,12 @@ namespace JSON {
Query::Query(const Var& source): _source(source)
{
if (!source.isEmpty() &&
source.type() != typeid(Object) &&
source.type() != typeid(Object::Ptr) &&
source.type() != typeid(Array) &&
source.type() != typeid(Array::Ptr))
throw InvalidArgumentException("Only JSON Object, Array or pointers thereof allowed.");
}