Skip to content

Commit 43cc880

Browse files
TheBlueMattrandom-zebra
authored andcommitted
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 5f1f014 commit 43cc880

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
@@ -263,7 +263,9 @@ void PrepareShutdown()
263263
}
264264

265265
// FlushStateToDisk generates a SetBestChain callback, which we should avoid missing
266-
FlushStateToDisk();
266+
if (pcoinsTip != nullptr) {
267+
FlushStateToDisk();
268+
}
267269

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

0 commit comments

Comments
 (0)