Skip to content

Commit c0025d0

Browse files
committed
Fix segfault when shutting down before fully loading
This was introduced by 3192975. It can be triggered easily when canceling DB upgrade from pre-per-utxo.
1 parent 1385697 commit c0025d0

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/init.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,9 @@ void Shutdown()
216216
}
217217

218218
// FlushStateToDisk generates a SetBestChain callback, which we should avoid missing
219-
FlushStateToDisk();
219+
if (pcoinsTip != nullptr) {
220+
FlushStateToDisk();
221+
}
220222

221223
// After there are no more peers/RPC left to give us new data which may generate
222224
// CValidationInterface callbacks, flush them...

0 commit comments

Comments
 (0)