mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-12 23:18:14 +01:00
check for null values in rpc args and handle appropriately
This commit is contained in:
@@ -106,12 +106,12 @@ UniValue importprivkey(const JSONRPCRequest& request)
|
||||
|
||||
std::string strSecret = request.params[0].get_str();
|
||||
std::string strLabel = "";
|
||||
if (request.params.size() > 1)
|
||||
if (!request.params[1].isNull())
|
||||
strLabel = request.params[1].get_str();
|
||||
|
||||
// Whether to perform rescan after import
|
||||
bool fRescan = true;
|
||||
if (request.params.size() > 2)
|
||||
if (!request.params[2].isNull())
|
||||
fRescan = request.params[2].get_bool();
|
||||
|
||||
if (fRescan && fPruneMode)
|
||||
@@ -245,12 +245,12 @@ UniValue importaddress(const JSONRPCRequest& request)
|
||||
|
||||
|
||||
std::string strLabel = "";
|
||||
if (request.params.size() > 1)
|
||||
if (!request.params[1].isNull())
|
||||
strLabel = request.params[1].get_str();
|
||||
|
||||
// Whether to perform rescan after import
|
||||
bool fRescan = true;
|
||||
if (request.params.size() > 2)
|
||||
if (!request.params[2].isNull())
|
||||
fRescan = request.params[2].get_bool();
|
||||
|
||||
if (fRescan && fPruneMode)
|
||||
@@ -258,7 +258,7 @@ UniValue importaddress(const JSONRPCRequest& request)
|
||||
|
||||
// Whether to import a p2sh version, too
|
||||
bool fP2SH = false;
|
||||
if (request.params.size() > 3)
|
||||
if (!request.params[3].isNull())
|
||||
fP2SH = request.params[3].get_bool();
|
||||
|
||||
LOCK2(cs_main, pwallet->cs_wallet);
|
||||
@@ -410,12 +410,12 @@ UniValue importpubkey(const JSONRPCRequest& request)
|
||||
|
||||
|
||||
std::string strLabel = "";
|
||||
if (request.params.size() > 1)
|
||||
if (!request.params[1].isNull())
|
||||
strLabel = request.params[1].get_str();
|
||||
|
||||
// Whether to perform rescan after import
|
||||
bool fRescan = true;
|
||||
if (request.params.size() > 2)
|
||||
if (!request.params[2].isNull())
|
||||
fRescan = request.params[2].get_bool();
|
||||
|
||||
if (fRescan && fPruneMode)
|
||||
@@ -1071,7 +1071,7 @@ UniValue importmulti(const JSONRPCRequest& mainRequest)
|
||||
//Default options
|
||||
bool fRescan = true;
|
||||
|
||||
if (mainRequest.params.size() > 1) {
|
||||
if (!mainRequest.params[1].isNull()) {
|
||||
const UniValue& options = mainRequest.params[1];
|
||||
|
||||
if (options.exists("rescan")) {
|
||||
|
||||
Reference in New Issue
Block a user