adding test for polylines() call with empty Point-s vector and fix for crash in this case

This commit is contained in:
Andrey Pavlenko
2015-04-24 16:40:14 +03:00
parent 26e3bcb9de
commit 40b762bceb
2 changed files with 23 additions and 0 deletions

View File

@@ -2215,7 +2215,10 @@ void cv::polylines(InputOutputArray _img, InputArrayOfArrays pts,
{
Mat p = pts.getMat(manyContours ? i : -1);
if( p.total() == 0 )
{
npts[i] = 0;
continue;
}
CV_Assert(p.checkVector(2, CV_32S) >= 0);
ptsptr[i] = (Point*)p.data;
npts[i] = p.rows*p.cols*p.channels()/2;