aboutsummaryrefslogtreecommitdiff
path: root/src/rpcmisc.cpp
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2015-11-09 08:40:46 +0100
committerWladimir J. van der Laan <laanwj@gmail.com>2015-11-09 08:44:19 +0100
commit2980a18572dbe6173c41afc037b0cefe367d935c (patch)
tree84c50cb7b8447730453204ff1739651542b1e9e3 /src/rpcmisc.cpp
parent4ee149a6db25cde31432f83369b40c92be13021c (diff)
Fix crash in validateaddress with -disablewallet
Fix a null pointer dereference in validateaddress with -disablewallet. Also add a regression testcase.
Diffstat (limited to 'src/rpcmisc.cpp')
-rw-r--r--src/rpcmisc.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/rpcmisc.cpp b/src/rpcmisc.cpp
index 0f0457c5cf..0c656d5cf1 100644
--- a/src/rpcmisc.cpp
+++ b/src/rpcmisc.cpp
@@ -117,7 +117,7 @@ public:
UniValue obj(UniValue::VOBJ);
CPubKey vchPubKey;
obj.push_back(Pair("isscript", false));
- if (pwalletMain->GetPubKey(keyID, vchPubKey)) {
+ if (pwalletMain && pwalletMain->GetPubKey(keyID, vchPubKey)) {
obj.push_back(Pair("pubkey", HexStr(vchPubKey)));
obj.push_back(Pair("iscompressed", vchPubKey.IsCompressed()));
}
@@ -128,7 +128,7 @@ public:
UniValue obj(UniValue::VOBJ);
CScript subscript;
obj.push_back(Pair("isscript", true));
- if (pwalletMain->GetCScript(scriptID, subscript)) {
+ if (pwalletMain && pwalletMain->GetCScript(scriptID, subscript)) {
std::vector<CTxDestination> addresses;
txnouttype whichType;
int nRequired;