[wallet] Make sure pindex is non-null before possibly referencing in LogPrintf call.

Github-Pull: #10265
Rebased-From: c36ea693ee
This commit is contained in:
Karl-Johan Alm
2017-04-24 08:48:12 +09:00
committed by Luke Dashjr
parent e23cef0c94
commit ff13f592c5

View File

@@ -1572,6 +1572,10 @@ CBlockIndex* CWallet::ScanForWalletTransactions(CBlockIndex* pindexStart, bool f
{ {
if (pindex->nHeight % 100 == 0 && dProgressTip - dProgressStart > 0.0) if (pindex->nHeight % 100 == 0 && dProgressTip - dProgressStart > 0.0)
ShowProgress(_("Rescanning..."), std::max(1, std::min(99, (int)((GuessVerificationProgress(chainParams.TxData(), pindex) - dProgressStart) / (dProgressTip - dProgressStart) * 100)))); ShowProgress(_("Rescanning..."), std::max(1, std::min(99, (int)((GuessVerificationProgress(chainParams.TxData(), pindex) - dProgressStart) / (dProgressTip - dProgressStart) * 100))));
if (GetTime() >= nNow + 60) {
nNow = GetTime();
LogPrintf("Still rescanning. At block %d. Progress=%f\n", pindex->nHeight, GuessVerificationProgress(chainParams.TxData(), pindex));
}
CBlock block; CBlock block;
if (ReadBlockFromDisk(block, pindex, Params().GetConsensus())) { if (ReadBlockFromDisk(block, pindex, Params().GetConsensus())) {
@@ -1585,10 +1589,6 @@ CBlockIndex* CWallet::ScanForWalletTransactions(CBlockIndex* pindexStart, bool f
ret = nullptr; ret = nullptr;
} }
pindex = chainActive.Next(pindex); pindex = chainActive.Next(pindex);
if (GetTime() >= nNow + 60) {
nNow = GetTime();
LogPrintf("Still rescanning. At block %d. Progress=%f\n", pindex->nHeight, GuessVerificationProgress(chainParams.TxData(), pindex));
}
} }
ShowProgress(_("Rescanning..."), 100); // hide progress dialog in GUI ShowProgress(_("Rescanning..."), 100); // hide progress dialog in GUI
} }