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
if (pindex == nullptr)
        return 0.0;
    int64_t nNow = time(nullptr);
    double fTxTotal;
    if (pindex->nChainTx <= data.nTxCount) {
        fTxTotal = data.nTxCount + (nNow - data.nTime) * data.dTxRate;
    } else {
        fTxTotal = pindex->nChainTx + (nNow - pindex->GetBlockTime()) * data.dTxRate;
    }
    return std::min<double>(pindex->nChainTx / fTxTotal, 1.0);
}
Optional<uint256> ChainstateManager::SnapshotBlockhash() const {
    if (m_active_chainstate != nullptr) {
        
        return m_active_chainstate->m_from_snapshot_blockhash;
    }
    return {};
}
std::vector<CChainState*> ChainstateManager::GetAll()
{
    std::vector<CChainState*> out;
    if (!IsSnapshotValidated() && m_ibd_chainstate) {
        out.push_back(m_ibd_chainstate.get());
    }
    if (m_snapshot_chainstate) {
        out.push_back(m_snapshot_chainstate.get());
    }
    return out;
}
CChainState& ChainstateManager::InitializeChainstate(CTxMemPool& mempool, const uint256& snapshot_blockhash)