From 57433502e6756b0dea7332026f3abf926daf0e35 Mon Sep 17 00:00:00 2001 From: Greg Sanders Date: Mon, 31 Mar 2025 13:01:54 -0400 Subject: [PATCH] CountDistinctClusters: nullptrs disallowed --- src/txgraph.cpp | 2 +- src/txgraph.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/txgraph.cpp b/src/txgraph.cpp index fa1395273da..22dce81fee1 100644 --- a/src/txgraph.cpp +++ b/src/txgraph.cpp @@ -1880,7 +1880,7 @@ TxGraph::GraphIndex TxGraphImpl::CountDistinctClusters(std::span clusters; clusters.reserve(refs.size()); for (const Ref* ref : refs) { - if (ref == nullptr) continue; + Assume(ref); if (GetRefGraph(*ref) == nullptr) continue; Assume(GetRefGraph(*ref) == this); auto cluster = FindCluster(GetRefIndex(*ref), level); diff --git a/src/txgraph.h b/src/txgraph.h index 803696440c2..91c3bd5cb17 100644 --- a/src/txgraph.h +++ b/src/txgraph.h @@ -159,8 +159,8 @@ public: virtual std::strong_ordering CompareMainOrder(const Ref& a, const Ref& b) noexcept = 0; /** Count the number of distinct clusters that the specified transactions belong to. If * main_only is false and a staging graph exists, staging clusters are counted. Otherwise, - * main clusters are counted. Refs that do not exist in the queried graph are ignored. The - * queried graph must not be oversized. */ + * main clusters are counted. Refs that do not exist in the queried graph are ignored. Refs + * can not be null. The queried graph must not be oversized. */ virtual GraphIndex CountDistinctClusters(std::span, bool main_only = false) noexcept = 0; /** Perform an internal consistency check on this object. */