[p2p] Check for nullptr before dereferencing pointer

This commit is contained in:
Adam Jonas authored and Amiti Uttarwar committed 2020-09-04 14:37:44 -07:00
1 parent cb79b9dbf4
commit fc66d0a65c
1 file changed
+3 -2
+3 -2
View File
@@ -1509,8 +1509,9 @@ void RelayTransaction(const uint256& txid, const uint256& wtxid, const CConnman&
{ {
LockAssertion lock(::cs_main); LockAssertion lock(::cs_main);
CNodeState &state = *State(pnode->GetId()); CNodeState* state = State(pnode->GetId());
if (state.m_wtxid_relay) { if (state == nullptr) return;
if (state->m_wtxid_relay) {
pnode->PushTxInventory(wtxid); pnode->PushTxInventory(wtxid);
} else { } else {
pnode->PushTxInventory(txid); pnode->PushTxInventory(txid);