mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-15 12:51:00 +02:00
Fix potential null dereferences
This commit is contained in:
parent
3e55f13bfc
commit
c001992440
4 changed files with 8 additions and 0 deletions
|
|
@ -281,6 +281,7 @@ void FinalizeNode(NodeId nodeid, bool& fUpdateConnectionTime) {
|
|||
fUpdateConnectionTime = false;
|
||||
LOCK(cs_main);
|
||||
CNodeState *state = State(nodeid);
|
||||
assert(state != nullptr);
|
||||
|
||||
if (state->fSyncStarted)
|
||||
nSyncStarted--;
|
||||
|
|
@ -315,6 +316,7 @@ bool MarkBlockAsReceived(const uint256& hash) {
|
|||
std::map<uint256, std::pair<NodeId, std::list<QueuedBlock>::iterator> >::iterator itInFlight = mapBlocksInFlight.find(hash);
|
||||
if (itInFlight != mapBlocksInFlight.end()) {
|
||||
CNodeState *state = State(itInFlight->second.first);
|
||||
assert(state != nullptr);
|
||||
state->nBlocksInFlightValidHeaders -= itInFlight->second.second->fValidatedHeaders;
|
||||
if (state->nBlocksInFlightValidHeaders == 0 && itInFlight->second.second->fValidatedHeaders) {
|
||||
// Last validated block on the queue was received.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue