Commit 8da63785 authored by Vadim Pisarevsky's avatar Vadim Pisarevsky

added extra check to avoid crashes

parent 06b233bd
......@@ -32,7 +32,7 @@ void on_trackbar(int, void*)
Mat dst = Mat::zeros(img.size(), CV_8UC3);
if( contours.size() > 0 )
if( !contours.empty() && !hierarchy.empty() )
{
// iterate through all the top-level contours,
// draw each connected component with its own random color
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment