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
{
    AssertLockHeld(cs_main);
    LOCK(m_pool.cs); 
    Workspace workspace(ptx);
    if (!PreChecks(args, workspace)) return false;
    
    
    
    
    PrecomputedTransactionData txdata;
    if (!PolicyScriptChecks(args, workspace, txdata)) return false;
    if (!ConsensusScriptChecks(args, workspace, txdata)) return false;
    
    if (args.m_test_accept) return true;
    if (!Finalize(args, workspace)) return false;
    GetMainSignals().TransactionAddedToMempool(ptx, m_pool.GetAndIncrementSequence());
    return true;
}
} 
static bool AcceptToMemoryPoolWithTime(const CChainParams& chainparams, CTxMemPool& pool, TxValidationState &state, const CTransactionRef &tx,
                        int64_t nAcceptTime, std::list<CTransactionRef>* plTxnReplaced,
                        bool bypass_limits, bool test_accept, CAmount* fee_out=nullptr) EXCLUSIVE_LOCKS_REQUIRED(cs_main)