]> granicus.if.org Git - postgis/commitdiff
ST_ForceRHR POLYGON EMPTY crash (#710)
authorPaul Ramsey <pramsey@cleverelephant.ca>
Wed, 22 Jun 2011 22:09:47 +0000 (22:09 +0000)
committerPaul Ramsey <pramsey@cleverelephant.ca>
Wed, 22 Jun 2011 22:09:47 +0000 (22:09 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@7446 b70326c6-7e19-0410-871a-916f4a2858ee

liblwgeom/lwpoly.c

index b05db7b2deee87b5b8db3b82565134d087ffd7c2..be6063ab0a5f26dbaaae0506a6b6b83760c74cd0 100644 (file)
@@ -503,18 +503,19 @@ lwpoly_force_clockwise(LWPOLY *poly)
 {
        int i;
 
+       /* No-op empties */
+       if ( lwpoly_is_empty(poly) )
+               return;
+
+       /* External ring */
        if ( ptarray_isccw(poly->rings[0]) )
-       {
                ptarray_reverse(poly->rings[0]);
-       }
 
+       /* Internal rings */
        for (i=1; i<poly->nrings; i++)
-       {
                if ( ! ptarray_isccw(poly->rings[i]) )
-               {
                        ptarray_reverse(poly->rings[i]);
-               }
-       }
+
 }
 
 void