Handle empty Json values:

* Replace Json::Value::isNull() and Json::Value::empty with operator bool()
This commit is contained in:
Tom Ritchford
2015-06-18 15:37:29 -04:00
committed by Nik Bougalis
parent a5a9242f4e
commit 9111ad1a9d
22 changed files with 67 additions and 77 deletions

View File

@@ -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)