Skip to content

Commit a40bd37

Browse files
committed
Get*Union: disallow nulltpr Refs
1 parent 5743350 commit a40bd37

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/txgraph.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1595,6 +1595,7 @@ std::vector<TxGraph::Ref*> TxGraphImpl::GetAncestorsUnion(std::span<const Ref* c
15951595
std::vector<std::pair<Cluster*, DepGraphIndex>> matches;
15961596
matches.reserve(args.size());
15971597
for (auto arg : args) {
1598+
Assume(arg);
15981599
// Skip empty Refs.
15991600
if (GetRefGraph(*arg) == nullptr) continue;
16001601
Assume(GetRefGraph(*arg) == this);
@@ -1627,6 +1628,7 @@ std::vector<TxGraph::Ref*> TxGraphImpl::GetDescendantsUnion(std::span<const Ref*
16271628
std::vector<std::pair<Cluster*, DepGraphIndex>> matches;
16281629
matches.reserve(args.size());
16291630
for (auto arg : args) {
1631+
Assume(arg);
16301632
// Skip empty Refs.
16311633
if (GetRefGraph(*arg) == nullptr) continue;
16321634
Assume(GetRefGraph(*arg) == this);

src/txgraph.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,11 +144,11 @@ class TxGraph
144144
virtual std::vector<Ref*> GetDescendants(const Ref& arg, bool main_only = false) noexcept = 0;
145145
/** Like GetAncestors, but return the Refs for all transactions in the union of the provided
146146
* arguments' ancestors (each transaction is only reported once). Refs that do not exist in
147-
* the queried graph are ignored. */
147+
* the queried graph are ignored. Null refs are not allowed. */
148148
virtual std::vector<Ref*> GetAncestorsUnion(std::span<const Ref* const> args, bool main_only = false) noexcept = 0;
149149
/** Like GetDescendants, but return the Refs for all transactions in the union of the provided
150150
* arguments' descendants (each transaction is only reported once). Refs that do not exist in
151-
* the queried graph are ignored. */
151+
* the queried graph are ignored. Null refs are not allowed. */
152152
virtual std::vector<Ref*> GetDescendantsUnion(std::span<const Ref* const> args, bool main_only = false) noexcept = 0;
153153
/** Get the total number of transactions in the graph. If main_only is false and a staging
154154
* graph exists, it is queried; otherwise the main graph is queried. This is available even

0 commit comments

Comments
 (0)