From 71b9e59c5af147120ae379df771ee1fb9490f9af Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 22 Feb 2018 12:00:08 +0200 Subject: [PATCH] Guard against set generate crash in regtest --- src/main.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index 72f25f1fc..99d66f4a2 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -4216,7 +4216,9 @@ void static CheckBlockIndex() // Build forward-pointing map of the entire block tree. std::multimap forward; for (BlockMap::iterator it = mapBlockIndex.begin(); it != mapBlockIndex.end(); it++) { - forward.insert(std::make_pair(it->second->pprev, it->second)); + if ( it != 0 && it->second != 0 ) + forward.insert(std::make_pair(it->second->pprev, it->second)); + else break; } assert(forward.size() == mapBlockIndex.size());