Make sure pindexWalk is non-null

This commit is contained in:
jl777
2018-03-14 21:33:11 +02:00
parent f233f9b156
commit 5298d41fae

View File

@@ -81,7 +81,8 @@ CBlockIndex* CBlockIndex::GetAncestor(int height)
CBlockIndex* pindexWalk = this;
int heightWalk = nHeight;
while (heightWalk > height) {
while ( heightWalk > height && pindexWalk != 0 )
{
int heightSkip = GetSkipHeight(heightWalk);
int heightSkipPrev = GetSkipHeight(heightWalk - 1);
if (pindexWalk->pskip != NULL &&