From 9b5da42745431272120c00dd1a20d75707447e85 Mon Sep 17 00:00:00 2001 From: Simon Date: Tue, 11 Jul 2017 18:03:10 -0700 Subject: [PATCH] Fixes #2480. Null entry in map was dereferenced leading to a segfault. --- src/wallet/asyncrpcoperation_sendmany.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/wallet/asyncrpcoperation_sendmany.cpp b/src/wallet/asyncrpcoperation_sendmany.cpp index ac4490197..901bd9e34 100644 --- a/src/wallet/asyncrpcoperation_sendmany.cpp +++ b/src/wallet/asyncrpcoperation_sendmany.cpp @@ -589,6 +589,10 @@ bool AsyncRPCOperation_sendmany::main_impl() { { LOCK2(cs_main, pwalletMain->cs_wallet); const CWalletTx& wtx = pwalletMain->mapWallet[jso.hash]; + // Zero confirmaton notes belong to transactions which have not yet been mined + if (mapBlockIndex.find(wtx.hashBlock) == mapBlockIndex.end()) { + throw JSONRPCError(RPC_WALLET_ERROR, strprintf("mapBlockIndex does not contain block hash %s", wtx.hashBlock.ToString())); + } wtxHeight = mapBlockIndex[wtx.hashBlock]->nHeight; wtxDepth = wtx.GetDepthInMainChain(); }