mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
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:
parent
993f1e8ada
commit
97633ec8db
@ -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!!
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user