Change CChain::Next() to take reference

To minimize chance of erroneous nullptr dereference, `CChain::Next()`
is changed to take a reference instead of a pointer.
Call sites have been adapted. Notably, NextSyncBlock() now checks
the FindFork() result before calling into Next(), because
the fork lookup may return null.
This commit is contained in:
optout
2026-01-29 12:01:23 +01:00
parent fe2d6e25e0
commit 20b58e281a
7 changed files with 21 additions and 21 deletions

View File

@@ -230,7 +230,7 @@ static bool rest_headers(const std::any& context,
if (headers.size() == *parsed_count) {
break;
}
pindex = active_chain.Next(pindex);
pindex = active_chain.Next(*pindex);
}
}
@@ -556,7 +556,7 @@ static bool rest_filter_header(const std::any& context, HTTPRequest* req, const
headers.push_back(pindex);
if (headers.size() == *parsed_count)
break;
pindex = active_chain.Next(pindex);
pindex = active_chain.Next(*pindex);
}
}