mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-20 15:00:36 -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
1 changed files with 10 additions and 0 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue