diff --git a/src/init.cpp b/src/init.cpp index 788477c24e599..69cccd51a9bfa 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -243,8 +243,8 @@ void PrepareShutdown() // 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(); diff --git a/src/validationinterface.cpp b/src/validationinterface.cpp index 45ae80cdc89c7..2ebed27c09af3 100644 --- a/src/validationinterface.cpp +++ b/src/validationinterface.cpp @@ -54,7 +54,9 @@ void CMainSignals::UnregisterBackgroundSignalScheduler() { } void CMainSignals::FlushBackgroundCallbacks() { - m_internals->m_schedulerClient.EmptyQueue(); + if (m_internals) { + m_internals->m_schedulerClient.EmptyQueue(); + } } CMainSignals& GetMainSignals() @@ -103,6 +105,9 @@ void UnregisterValidationInterface(CValidationInterface* pwalletIn) { } void UnregisterAllValidationInterfaces() { + if (!g_signals.m_internals) { + return; + } g_signals.m_internals->BlockChecked.disconnect_all_slots(); g_signals.m_internals->Broadcast.disconnect_all_slots(); g_signals.m_internals->Inventory.disconnect_all_slots();