mirror of
https://github.com/Xahau/xahaud.git
synced 2025-11-25 04:55:50 +00:00
Handle empty Json values:
* Replace Json::Value::isNull() and Json::Value::empty with operator bool()
This commit is contained in:
committed by
Nik Bougalis
parent
a5a9242f4e
commit
9111ad1a9d
@@ -242,7 +242,7 @@ ServerHandlerImp::processRequest (
|
||||
Json::Reader reader;
|
||||
if ((request.size () > 1000000) ||
|
||||
! reader.parse (request, jsonRPC) ||
|
||||
jsonRPC.isNull () ||
|
||||
! jsonRPC ||
|
||||
! jsonRPC.isObject ())
|
||||
{
|
||||
HTTPReply (400, "Unable to parse request", output);
|
||||
@@ -258,7 +258,7 @@ ServerHandlerImp::processRequest (
|
||||
|
||||
Json::Value const& method = jsonRPC ["method"];
|
||||
|
||||
if (method.isNull ()) {
|
||||
if (! method) {
|
||||
HTTPReply (400, "Null method", output);
|
||||
return;
|
||||
}
|
||||
@@ -313,7 +313,7 @@ ServerHandlerImp::processRequest (
|
||||
// and we take that first entry and validate that it's an object.
|
||||
Json::Value params = jsonRPC [jss::params];
|
||||
|
||||
if (params.isNull () || params.empty())
|
||||
if (! params)
|
||||
params = Json::Value (Json::objectValue);
|
||||
|
||||
else if (!params.isArray () || params.size() != 1)
|
||||
|
||||
Reference in New Issue
Block a user