]> rtime.felk.cvut.cz Git - opencv.git/commitdiff
fixed crash in cvSubdiv2DFindNearest when the subdivision is empty (SF bug #2829344)
authorvp153 <vp153@73c94f0f-984f-4a5f-82bc-2d8db8d8ee08>
Mon, 28 Sep 2009 00:10:11 +0000 (00:10 +0000)
committervp153 <vp153@73c94f0f-984f-4a5f-82bc-2d8db8d8ee08>
Mon, 28 Sep 2009 00:10:11 +0000 (00:10 +0000)
git-svn-id: https://code.ros.org/svn/opencv/trunk@2192 73c94f0f-984f-4a5f-82bc-2d8db8d8ee08

opencv/src/cv/cvsubdivision2d.cpp

index 06f6095f245d9021433206322578515c5a7b9f92..720a928f622d6e44a1a8a9f110e8dad2977a8838 100644 (file)
@@ -740,6 +740,9 @@ cvFindNearestPoint2D( CvSubdiv2D* subdiv, CvPoint2D32f pt )
 
     if( !CV_IS_SUBDIV2D( subdiv ))
         CV_ERROR( CV_StsNullPtr, "" );
+    
+    if( subdiv->edges->active_count <= 3 )
+        EXIT;
 
     if( !subdiv->is_geometry_valid )
         cvCalcSubdivVoronoi2D( subdiv );