aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Corallo <matt@bluematt.me>2011-07-14 03:11:40 +0200
committerMatt Corallo <matt@bluematt.me>2011-07-14 03:11:40 +0200
commit0d7b28e52ea5302ce6aa17399a0027e33168c372 (patch)
treee5f66dbc4fa2f57fbd468cf5aca50fd4b32aafd3
parent9cd22ab86296ae7039132423c7f9847bdc19a644 (diff)
Fix crashes when a wallet is locked and GetReservedKey() is called
-rw-r--r--src/wallet.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/wallet.cpp b/src/wallet.cpp
index f275853528..5f7cddf57e 100644
--- a/src/wallet.cpp
+++ b/src/wallet.cpp
@@ -1320,7 +1320,10 @@ vector<unsigned char> CReserveKey::GetReservedKey()
{
CKeyPool keypool;
pwallet->ReserveKeyFromKeyPool(nIndex, keypool);
- vchPubKey = keypool.vchPubKey;
+ if (nIndex != -1)
+ vchPubKey = keypool.vchPubKey;
+ else
+ vchPubKey = vchDefaultKey;
}
assert(!vchPubKey.empty());
return vchPubKey;