diff --git a/src/txdb.cpp b/src/txdb.cpp index 67d15cb58f..6550f57876 100644 --- a/src/txdb.cpp +++ b/src/txdb.cpp @@ -58,7 +58,8 @@ bool CCoinsViewDB::BatchWrite(const std::map &mapCoins, CBlockI CLevelDBBatch batch; for (std::map::const_iterator it = mapCoins.begin(); it != mapCoins.end(); it++) BatchWriteCoins(batch, it->first, it->second); - BatchWriteHashBestChain(batch, pindex->GetBlockHash()); + if (pindex) + BatchWriteHashBestChain(batch, pindex->GetBlockHash()); return db.WriteBatch(batch); }