Add null check to deref

This commit is contained in:
miketout
2018-10-05 21:37:49 -07:00
parent 95c5c69bab
commit a6ac51616c

View File

@@ -403,7 +403,7 @@ namespace {
if (!state->hashLastUnknownBlock.IsNull()) {
BlockMap::iterator itOld = mapBlockIndex.find(state->hashLastUnknownBlock);
if (itOld != mapBlockIndex.end() && itOld->second->chainPower > CChainPower())
if (itOld != mapBlockIndex.end() && itOld->second != 0 && (itOld->second->chainPower > CChainPower()))
{
if (state->pindexBestKnownBlock == NULL || itOld->second->chainPower >= state->pindexBestKnownBlock->chainPower)
state->pindexBestKnownBlock = itOld->second;