[p2p] Check for nullptr before dereferencing pointer

This commit is contained in:
Adam Jonas 2020-08-17 16:35:03 -04:00 committed by Amiti Uttarwar
parent cb79b9dbf4
commit fc66d0a65c

View file

@ -1509,8 +1509,9 @@ void RelayTransaction(const uint256& txid, const uint256& wtxid, const CConnman&
{
LockAssertion lock(::cs_main);
CNodeState &state = *State(pnode->GetId());
if (state.m_wtxid_relay) {
CNodeState* state = State(pnode->GetId());
if (state == nullptr) return;
if (state->m_wtxid_relay) {
pnode->PushTxInventory(wtxid);
} else {
pnode->PushTxInventory(txid);