aboutsummaryrefslogtreecommitdiff
path: root/src/init.cpp
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2017-11-28 12:08:09 +0100
committerWladimir J. van der Laan <laanwj@gmail.com>2017-11-28 12:12:05 +0100
commitd31e5c1d0f303a8cd97077d425488ed5abdf5345 (patch)
treed679abc9eab2edd8636df68df5a143fb35cf600f /src/init.cpp
parent26efc220a13aa3413f6e55e311e8991445104f82 (diff)
downloadbitcoin-d31e5c1d0f303a8cd97077d425488ed5abdf5345.tar.xz
Fix shutdown in case of errors during initialization
PR #10286 introduced a few steps which are not robust to early shutdown in initialization. Stumbled upon this with #11781, not sure if there are other scenarios that can trigger it, but it's harden against this in any case.
Diffstat (limited to 'src/init.cpp')
-rw-r--r--src/init.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/init.cpp b/src/init.cpp
index 3cc797a17c..98915e9841 100644
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -193,8 +193,8 @@ void Shutdown()
// Because these depend on each-other, we make sure that neither can be
// using the other before destroying them.
- UnregisterValidationInterface(peerLogic.get());
- if(g_connman) g_connman->Stop();
+ if (peerLogic) UnregisterValidationInterface(peerLogic.get());
+ if (g_connman) g_connman->Stop();
peerLogic.reset();
g_connman.reset();