Fix crash in validateaddress with -disablewallet

Closes #696
This commit is contained in:
crowning- 2016-02-14 13:35:31 +01:00 committed by Holger Schinzel
parent cfc8cc2fe5
commit 1f70fb3c04

View File

@ -167,10 +167,11 @@ public:
CPubKey vchPubKey; CPubKey vchPubKey;
obj.push_back(Pair("isscript", false)); obj.push_back(Pair("isscript", false));
if (mine == ISMINE_SPENDABLE) { if (mine == ISMINE_SPENDABLE) {
pwalletMain->GetPubKey(keyID, vchPubKey); if (pwalletMain && pwalletMain->GetPubKey(keyID, vchPubKey)) {
obj.push_back(Pair("pubkey", HexStr(vchPubKey))); obj.push_back(Pair("pubkey", HexStr(vchPubKey)));
obj.push_back(Pair("iscompressed", vchPubKey.IsCompressed())); obj.push_back(Pair("iscompressed", vchPubKey.IsCompressed()));
} }
}
return obj; return obj;
} }
@ -179,7 +180,7 @@ public:
obj.push_back(Pair("isscript", true)); obj.push_back(Pair("isscript", true));
if (mine != ISMINE_NO) { if (mine != ISMINE_NO) {
CScript subscript; CScript subscript;
pwalletMain->GetCScript(scriptID, subscript); if (pwalletMain && pwalletMain->GetCScript(scriptID, subscript)){
std::vector<CTxDestination> addresses; std::vector<CTxDestination> addresses;
txnouttype whichType; txnouttype whichType;
int nRequired; int nRequired;
@ -193,6 +194,7 @@ public:
if (whichType == TX_MULTISIG) if (whichType == TX_MULTISIG)
obj.push_back(Pair("sigsrequired", nRequired)); obj.push_back(Pair("sigsrequired", nRequired));
} }
}
return obj; return obj;
} }
}; };