check for null reference

This commit is contained in:
Evan Duffield 2015-02-05 09:01:14 -07:00
parent c8fc2633ee
commit 1e8b4cdbf0

View File

@ -540,6 +540,7 @@ void static BitcoinMiner(CWallet *pwallet)
// //
unsigned int nTransactionsUpdatedLast = mempool.GetTransactionsUpdated(); unsigned int nTransactionsUpdatedLast = mempool.GetTransactionsUpdated();
CBlockIndex* pindexPrev = chainActive.Tip(); CBlockIndex* pindexPrev = chainActive.Tip();
if(!pindexPrev) break;
auto_ptr<CBlockTemplate> pblocktemplate(CreateNewBlockWithKey(reservekey)); auto_ptr<CBlockTemplate> pblocktemplate(CreateNewBlockWithKey(reservekey));
if (!pblocktemplate.get()) if (!pblocktemplate.get())
@ -547,6 +548,7 @@ void static BitcoinMiner(CWallet *pwallet)
CBlock *pblock = &pblocktemplate->block; CBlock *pblock = &pblocktemplate->block;
IncrementExtraNonce(pblock, pindexPrev, nExtraNonce); IncrementExtraNonce(pblock, pindexPrev, nExtraNonce);
LogPrintf("Running DarkcoinMiner with %u transactions in block (%u bytes)\n", pblock->vtx.size(), LogPrintf("Running DarkcoinMiner with %u transactions in block (%u bytes)\n", pblock->vtx.size(),
::GetSerializeSize(*pblock, SER_NETWORK, PROTOCOL_VERSION)); ::GetSerializeSize(*pblock, SER_NETWORK, PROTOCOL_VERSION));