Skip to content

Commit

Permalink
fix #2339 the right way (#2360)
Browse files Browse the repository at this point in the history
* fix #2339 the right way

Signed-off-by: Saif Kandil <74428638+k0T0z@users.noreply.github.com>

* Update json.cpp

---------

Signed-off-by: Saif Kandil <74428638+k0T0z@users.noreply.github.com>
  • Loading branch information
k0T0z committed Aug 27, 2023
1 parent 8d105a4 commit 3e24167
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
15 changes: 14 additions & 1 deletion ENIGMAsystem/SHELL/Universal_System/Extensions/Json/json.cpp
Expand Up @@ -174,7 +174,20 @@ namespace enigma_user
DEBUG_MESSAGE("Failed to parse configuration" + reader.getFormattedErrorMessages(), MESSAGE_TYPE::M_ERROR);
return -1;
}
return RecursiveDSMap(root);

if (root.isObject())
{
return RecursiveDSMap(root);
}
else if (root.isArray())
{
return RecursiveDSList(root);
}
else
{
DEBUG_MESSAGE("Invalid JSON. The root is not as array of objects or an object.", MESSAGE_TYPE::M_ERROR);
return -1;
}
}

string json_encode(variant ds_map) {
Expand Down
Expand Up @@ -1205,8 +1205,8 @@ Value::isMember( const CppTL::ConstString &key ) const

Value::Members Value::getMemberNames() const
{
JSON_ASSERT( type_ == nullValue || type_ == arrayValue || type_ == objectValue );
if ( type_ == nullValue || type_ == arrayValue )
JSON_ASSERT( type_ == nullValue || type_ == objectValue );
if ( type_ == nullValue )
return Value::Members();
Members members;
members.reserve( value_.map_->size() );
Expand Down

0 comments on commit 3e24167

Please sign in to comment.