diff --git a/src/main.cpp b/src/main.cpp index 182983673..5090b94fa 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -3033,7 +3033,7 @@ bool InvalidateBlock(CValidationState& state, CBlockIndex *pindex) { // The resulting new best tip may not be in setBlockIndexCandidates anymore, so // add it again. BlockMap::iterator it = mapBlockIndex.begin(); - while (it != mapBlockIndex.end()) { + while (it != mapBlockIndex.end() && it->second != 0 ) { if (it->second->IsValid(BLOCK_VALID_TRANSACTIONS) && it->second->nChainTx && !setBlockIndexCandidates.value_comp()(it->second, chainActive.Tip())) { setBlockIndexCandidates.insert(it->second); }