mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-24 13:05:53 +00:00
Prevent RPC handlers from returning non-objects.
This commit is contained in:
@@ -32,6 +32,12 @@ Handler::Method<Json::Value> byRef (Function const& f)
|
|||||||
return [f] (Context& context, Json::Value& result)
|
return [f] (Context& context, Json::Value& result)
|
||||||
{
|
{
|
||||||
result = f (context);
|
result = f (context);
|
||||||
|
if (result.type() != Json::objectValue)
|
||||||
|
{
|
||||||
|
assert (false);
|
||||||
|
result = RPC::makeObjectValue (result);
|
||||||
|
}
|
||||||
|
|
||||||
return Status();
|
return Status();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user