https://github.com/bitcoin/bitcoin/blob/9ad6f14175c19b5d47267c3dd5840c14bad43c83/src/validation.cpp#L3711

If i'm following right the flow of the code, when we hit this lane `pindex` should be always equal to nullptr thus this check may be omitted
CheckBlockIndex(chainparams.GetConsensus());
    if (!accepted_header)
        return false;
    
    
    
    bool fAlreadyHave = pindex->nStatus & BLOCK_HAVE_DATA;
    bool fHasMoreOrSameWork = (m_chain.Tip() ? pindex->nChainWork >= m_chain.Tip()->nChainWork : true);
    
    
    
    
    
    bool fTooFarAhead = (pindex->nHeight > int(m_chain.Height() + MIN_BLOCKS_TO_KEEP));
    
    
    
    
    
    
    if (fAlreadyHave) return true;
    if (!fRequested) {  
        if (pindex->nTx != 0) return true;    
        if (!fHasMoreOrSameWork) return true; 
        if (fTooFarAhead) return true;        
        
        
        
        
        if (pindex->nChainWork < nMinimumChainWork) return true;