From 0d7b28e52ea5302ce6aa17399a0027e33168c372 Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Thu, 14 Jul 2011 03:11:40 +0200 Subject: [PATCH] Fix crashes when a wallet is locked and GetReservedKey() is called --- src/wallet.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/wallet.cpp b/src/wallet.cpp index f2758535..5f7cddf5 100644 --- a/src/wallet.cpp +++ b/src/wallet.cpp @@ -1320,7 +1320,10 @@ vector 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;