Don't permit XRP to be specified as an object.

This commit is contained in:
JoelKatz
2013-03-31 23:55:59 -07:00
parent bd4e00e391
commit 526b4a4a6d

View File

@@ -158,7 +158,13 @@ STAmount::STAmount(SField::ref n, const Json::Value& v)
mIsNative = !currency.isString() || currency.asString().empty() || (currency.asString() == SYSTEM_CURRENCY_CODE);
if (!mIsNative) {
if (mIsNative)
{
if (v.isObject())
throw std::runtime_error("XRP may not be specified as an object");
}
else
{ // non-XRP
if (!currencyFromString(mCurrency, currency.asString()))
throw std::runtime_error("invalid currency");