From c6b63e0e28001e0def94850feaa8c8851769ce92 Mon Sep 17 00:00:00 2001 From: Alexander Alekhin Date: Thu, 1 Oct 2020 15:20:32 +0000 Subject: [PATCH] calib3d/imgproc: add GCGraph::maxFlow() missing empty checks --- modules/imgproc/src/gcgraph.hpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/modules/imgproc/src/gcgraph.hpp b/modules/imgproc/src/gcgraph.hpp index 16c25de..8730e1f 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; -- 2.7.4