Fix crash if JSON object deserialization

In case an object was expected while another type was got RsSerializable
JSON deserialization code was crashing, this commit solve the crash in
this not so corner case
This commit is contained in:
Gioacchino Mazzurco 2019-01-10 19:06:35 +01:00
parent 993f1e8ada
commit 97633ec8db
No known key found for this signature in database
GPG Key ID: A1FBCA3872E87051

View File

@ -753,6 +753,16 @@ struct RsTypeSerializer
rapidjson::Value& v = jDoc[mName];
if(!v.IsObject())
{
std::cerr << __PRETTY_FUNCTION__ << " \"" << memberName
<< "\" has wrong type in JSON, object expected, got:"
<< std::endl << jDoc << std::endl << std::endl;
print_stacktrace();
ctx.mOk = false;
break;
}
RsGenericSerializer::SerializeContext lCtx(nullptr, 0, ctx.mFlags);
lCtx.mJson.SetObject() = v; // Beware of move semantic!!