Skip to content

Commit fa8fffe

Browse files
author
MarcoFalke
committed
refactor: Prefer clean assert over UB in coinstats
1 parent ad4bf8a commit fa8fffe

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/node/coinstats.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,8 @@ static bool GetUTXOStats(CCoinsView* view, BlockManager& blockman, CCoinsStats&
9494
{
9595
LOCK(cs_main);
9696
assert(std::addressof(g_chainman.m_blockman) == std::addressof(blockman));
97-
stats.nHeight = blockman.LookupBlockIndex(stats.hashBlock)->nHeight;
97+
const CBlockIndex* block = blockman.LookupBlockIndex(stats.hashBlock);
98+
stats.nHeight = Assert(block)->nHeight;
9899
}
99100

100101
PrepareHash(hash_obj, stats);

0 commit comments

Comments
 (0)