diff --git a/modules/imgproc/src/gcgraph.hpp b/modules/imgproc/src/gcgraph.hpp index 16c25dea31..8730e1fe6e 100644 --- a/modules/imgproc/src/gcgraph.hpp +++ b/modules/imgproc/src/gcgraph.hpp @@ -152,6 +152,8 @@ void GCGraph::addTermWeights( int i, TWeight sourceW, TWeight sinkW ) template TWeight GCGraph::maxFlow() { + CV_Assert(!vtcs.empty()); + CV_Assert(!edges.empty()); const int TERMINAL = -1, ORPHAN = -2; Vtx stub, *nilNode = &stub, *first = nilNode, *last = nilNode; int curr_ts = 0;