mirror of
https://github.com/pocoproject/poco.git
synced 2025-01-19 00:46:03 +01:00
Fix nullptr deref in Poco::JSON::Object (#2150)
This commit is contained in:
parent
d9bff00222
commit
bdd0478ead
@ -346,8 +346,7 @@ inline bool Object::isArray(const std::string& key) const
|
||||
|
||||
inline bool Object::isArray(ConstIterator& it) const
|
||||
{
|
||||
const std::type_info& ti = it->second.type();
|
||||
return it != _values.end() && (ti == typeid(Array::Ptr) || ti == typeid(Array));
|
||||
return it != _values.end() && (it->second.type() == typeid(Array::Ptr) || it->second.type() == typeid(Array));
|
||||
}
|
||||
|
||||
|
||||
@ -367,8 +366,7 @@ inline bool Object::isObject(const std::string& key) const
|
||||
|
||||
inline bool Object::isObject(ConstIterator& it) const
|
||||
{
|
||||
const std::type_info& ti = it->second.type();
|
||||
return it != _values.end() && (ti == typeid(Object::Ptr) || ti == typeid(Object));
|
||||
return it != _values.end() && (it->second.type() == typeid(Object::Ptr) || it->second.type() == typeid(Object));
|
||||
}
|
||||
|
||||
|
||||
|
@ -643,6 +643,9 @@ void JSONTest::testObjectProperty()
|
||||
assert (object->isObject("test"));
|
||||
assert (!object->isArray("test"));
|
||||
|
||||
assert (!object->isArray("nonExistentKey"));
|
||||
assert (!object->isObject("nonExistentKey"));
|
||||
|
||||
Var test = object->get("test");
|
||||
assert (test.type() == typeid(Object::Ptr));
|
||||
Object::Ptr subObject = test.extract<Object::Ptr>();
|
||||
|
Loading…
x
Reference in New Issue
Block a user