aboutsummaryrefslogtreecommitdiff
path: root/src/index/base.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/index/base.cpp')
-rw-r--r--src/index/base.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/index/base.cpp b/src/index/base.cpp
index 2e3d500cd1..8fe30f8960 100644
--- a/src/index/base.cpp
+++ b/src/index/base.cpp
@@ -211,6 +211,11 @@ bool BaseIndex::Commit()
bool BaseIndex::CommitInternal(CDBBatch& batch)
{
LOCK(cs_main);
+ // Don't commit anything if we haven't indexed any block yet
+ // (this could happen if init is interrupted).
+ if (m_best_block_index == nullptr) {
+ return false;
+ }
GetDB().WriteBestBlock(batch, m_chainstate->m_chain.GetLocator(m_best_block_index));
return true;
}