Defensively check for a null pindex in `FindFork`

This commit is contained in:
Kris Nuttycombe 2022-04-11 14:36:36 -06:00
parent 72fc17ffc7
commit 0b02d66bba
1 changed files with 1 additions and 0 deletions

View File

@ -49,6 +49,7 @@ CBlockLocator CChain::GetLocator(const CBlockIndex *pindex) const {
}
const CBlockIndex *CChain::FindFork(const CBlockIndex *pindex) const {
assert(pindex != nullptr);
if (pindex->nHeight > Height())
pindex = pindex->GetAncestor(Height());
while (pindex && !Contains(pindex))