aboutsummaryrefslogtreecommitdiff
path: root/src/init.cpp
diff options
context:
space:
mode:
authorMatt Corallo <git@bluematt.me>2017-07-15 20:03:11 -0400
committerMatt Corallo <git@bluematt.me>2017-07-27 15:03:05 -0400
commitc0025d0a92e438155901438580e4d2ebb376b951 (patch)
tree8f81601c56c9a80b6a1c39ebbf77939bc116645c /src/init.cpp
parent138569722cae09bb9e3bc31bbae4b1886b904bb5 (diff)
downloadbitcoin-c0025d0a92e438155901438580e4d2ebb376b951.tar.xz
Fix segfault when shutting down before fully loading
This was introduced by 3192975f1d177aa9f0bbd823c6387cfbfa943610. It can be triggered easily when canceling DB upgrade from pre-per-utxo.
Diffstat (limited to 'src/init.cpp')
-rw-r--r--src/init.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/init.cpp b/src/init.cpp
index 5b7379e16e..2ca3ec17ac 100644
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -216,7 +216,9 @@ void Shutdown()
}
// FlushStateToDisk generates a SetBestChain callback, which we should avoid missing
- FlushStateToDisk();
+ if (pcoinsTip != nullptr) {
+ FlushStateToDisk();
+ }
// After there are no more peers/RPC left to give us new data which may generate
// CValidationInterface callbacks, flush them...