Fixes #2480. Null entry in map was dereferenced leading to a segfault.

This commit is contained in:
Simon 2017-07-11 18:03:10 -07:00
parent 5df11e9d8e
commit 9b5da42745
1 changed files with 4 additions and 0 deletions

View File

@ -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();
}