Skip to content

Commit a5b8f16

Browse files
committed
Merge pull request opencv#18488 from alalek:maxflow_missing_check
2 parents 6add3b9 + c6b63e0 commit a5b8f16

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

modules/imgproc/src/gcgraph.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,8 @@ void GCGraph<TWeight>::addTermWeights( int i, TWeight sourceW, TWeight sinkW )
152152
template <class TWeight>
153153
TWeight GCGraph<TWeight>::maxFlow()
154154
{
155+
CV_Assert(!vtcs.empty());
156+
CV_Assert(!edges.empty());
155157
const int TERMINAL = -1, ORPHAN = -2;
156158
Vtx stub, *nilNode = &stub, *first = nilNode, *last = nilNode;
157159
int curr_ts = 0;

0 commit comments

Comments
 (0)