From 0b297a614f80214dbd826fe5af92b4eaa60911bb Mon Sep 17 00:00:00 2001 From: Pieter Wuille Date: Sun, 28 Oct 2012 19:14:51 +0100 Subject: [PATCH] Bugfix: don't crash by trying to write unchanged best block --- src/txdb.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/txdb.cpp b/src/txdb.cpp index 67d15cb5..6550f578 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); }