Eliminate mapBlockIndex risk of nulls across VRSC

This commit is contained in:
miketout
2018-10-14 11:59:13 -07:00
parent aeadfa0490
commit d565e7b73c
6 changed files with 31 additions and 23 deletions

View File

@@ -650,10 +650,11 @@ bool CBlockTreeDB::ReadFlag(const std::string &name, bool &fValue) {
void komodo_index2pubkey33(uint8_t *pubkey33,CBlockIndex *pindex,int32_t height);
bool CBlockTreeDB::blockOnchainActive(const uint256 &hash) {
CBlockIndex* pblockindex = mapBlockIndex[hash];
BlockMap::const_iterator it = mapBlockIndex.find(hash);
CBlockIndex* pblockindex = it != mapBlockIndex.end() ? it->second : NULL;
if (!chainActive.Contains(pblockindex)) {
return false;
if (!pblockindex || !chainActive.Contains(pblockindex)) {
return false;
}
return true;