mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-23 12:35:50 +00:00
Cleanup some Json::Value methods:
* Rename isArray to isArrayOrNull * Rename isObject to isObjectOrNull * Introduce isArray and isObject * Change as many uses of isArrayorNull to isArray as possible * Change as many uses of isObjectorNull to isObject as possible * Reject null JSON arrays for subscribe and unsubscribe
This commit is contained in:
committed by
Mike Ellery
parent
20defb4844
commit
1a245234f1
@@ -806,13 +806,17 @@ amountFromJson (SField const& name, Json::Value const& v)
|
||||
Json::Value currency;
|
||||
Json::Value issuer;
|
||||
|
||||
if (v.isObject ())
|
||||
if (v.isNull())
|
||||
{
|
||||
Throw<std::runtime_error> ("XRP may not be specified with a null Json value");
|
||||
}
|
||||
else if (v.isObject())
|
||||
{
|
||||
value = v[jss::value];
|
||||
currency = v[jss::currency];
|
||||
issuer = v[jss::issuer];
|
||||
}
|
||||
else if (v.isArray ())
|
||||
else if (v.isArray())
|
||||
{
|
||||
value = v.get (Json::UInt (0), 0);
|
||||
currency = v.get (Json::UInt (1), Json::nullValue);
|
||||
@@ -846,7 +850,7 @@ amountFromJson (SField const& name, Json::Value const& v)
|
||||
|
||||
if (native)
|
||||
{
|
||||
if (v.isObject ())
|
||||
if (v.isObjectOrNull ())
|
||||
Throw<std::runtime_error> ("XRP may not be specified as an object");
|
||||
issue = xrpIssue ();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user