mirror of
https://github.com/opencv/opencv.git
synced 2025-08-06 14:36:36 +08:00
added extra check to avoid crashes
This commit is contained in:
parent
06b233bdc9
commit
8da637854c
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user