diff src/wallet.cpp @ 793:d9ff6173c6d8 draft

Fix crashes when a wallet is locked and GetReservedKey() is called
author Matt Corallo <matt@bluematt.me>
date Thu, 14 Jul 2011 03:11:40 +0200
parents 9499138de3e6
children 8bbe72401a58
line wrap: on
line diff
--- a/src/wallet.cpp
+++ b/src/wallet.cpp
@@ -1320,7 +1320,10 @@
     {
         CKeyPool keypool;
         pwallet->ReserveKeyFromKeyPool(nIndex, keypool);
-        vchPubKey = keypool.vchPubKey;
+        if (nIndex != -1)
+            vchPubKey = keypool.vchPubKey;
+        else
+            vchPubKey = vchDefaultKey;
     }
     assert(!vchPubKey.empty());
     return vchPubKey;