From ec8e40907d91c0cb8c2d6a61364aec76c4d6f7c1 Mon Sep 17 00:00:00 2001 From: SChernykh Date: Sun, 15 Jan 2023 22:20:06 +0100 Subject: [PATCH] Fixed a crash in `status` command --- src/side_chain.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/side_chain.cpp b/src/side_chain.cpp index 044c284..5d5583a 100644 --- a/src/side_chain.cpp +++ b/src/side_chain.cpp @@ -886,9 +886,11 @@ void SideChain::print_status(bool obtain_sidechain_lock) const std::vector shares; uint64_t bottom_height = 0; - get_shares(tip, shares, &bottom_height, true); + if (tip) { + get_shares(tip, shares, &bottom_height, true); + } - const uint64_t window_size = bottom_height ? (tip->m_sidechainHeight - bottom_height + 1U) : m_chainWindowSize; + const uint64_t window_size = (tip && bottom_height) ? (tip->m_sidechainHeight - bottom_height + 1U) : m_chainWindowSize; uint64_t block_depth = 0; const PoolBlock* cur = tip;