diff options
author | Matt Corallo <git@bluematt.me> | 2017-07-15 20:03:11 -0400 |
---|---|---|
committer | Matt Corallo <git@bluematt.me> | 2017-07-27 15:03:05 -0400 |
commit | c0025d0a92e438155901438580e4d2ebb376b951 (patch) | |
tree | 8f81601c56c9a80b6a1c39ebbf77939bc116645c /src/init.cpp | |
parent | 138569722cae09bb9e3bc31bbae4b1886b904bb5 (diff) |
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.cpp | 4 |
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... |