diff options
Diffstat (limited to 'src/rpcwallet.cpp')
-rw-r--r-- | src/rpcwallet.cpp | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/src/rpcwallet.cpp b/src/rpcwallet.cpp index 46338bdf26..4bf3580320 100644 --- a/src/rpcwallet.cpp +++ b/src/rpcwallet.cpp @@ -21,7 +21,7 @@ static CCriticalSection cs_nWalletUnlockTime; std::string HelpRequiringPassphrase() { - return pwalletMain->IsCrypted() + return pwalletMain && pwalletMain->IsCrypted() ? "\nrequires wallet passphrase to be set with walletpassphrase first" : ""; } @@ -72,18 +72,22 @@ Value getinfo(const Array& params, bool fHelp) Object obj; obj.push_back(Pair("version", (int)CLIENT_VERSION)); obj.push_back(Pair("protocolversion",(int)PROTOCOL_VERSION)); - obj.push_back(Pair("walletversion", pwalletMain->GetVersion())); - obj.push_back(Pair("balance", ValueFromAmount(pwalletMain->GetBalance()))); + if (pwalletMain) { + obj.push_back(Pair("walletversion", pwalletMain->GetVersion())); + obj.push_back(Pair("balance", ValueFromAmount(pwalletMain->GetBalance()))); + } obj.push_back(Pair("blocks", (int)nBestHeight)); obj.push_back(Pair("timeoffset", (boost::int64_t)GetTimeOffset())); obj.push_back(Pair("connections", (int)vNodes.size())); obj.push_back(Pair("proxy", (proxy.first.IsValid() ? proxy.first.ToStringIPPort() : string()))); obj.push_back(Pair("difficulty", (double)GetDifficulty())); obj.push_back(Pair("testnet", TestNet())); - obj.push_back(Pair("keypoololdest", (boost::int64_t)pwalletMain->GetOldestKeyPoolTime())); - obj.push_back(Pair("keypoolsize", (int)pwalletMain->GetKeyPoolSize())); + if (pwalletMain) { + obj.push_back(Pair("keypoololdest", (boost::int64_t)pwalletMain->GetOldestKeyPoolTime())); + obj.push_back(Pair("keypoolsize", (int)pwalletMain->GetKeyPoolSize())); + } obj.push_back(Pair("paytxfee", ValueFromAmount(nTransactionFee))); - if (pwalletMain->IsCrypted()) + if (pwalletMain && pwalletMain->IsCrypted()) obj.push_back(Pair("unlocked_until", (boost::int64_t)nWalletUnlockTime)); obj.push_back(Pair("errors", GetWarnings("statusbar"))); return obj; @@ -738,7 +742,7 @@ static CScript _createmultisig(const Array& params) // Case 1: Bitcoin address and we have full public key: CBitcoinAddress address(ks); - if (address.IsValid()) + if (pwalletMain && address.IsValid()) { CKeyID keyID; if (!address.GetKeyID(keyID)) |