From: Paul Ramsey Date: Wed, 22 Jun 2011 22:09:47 +0000 (+0000) Subject: ST_ForceRHR POLYGON EMPTY crash (#710) X-Git-Tag: 2.0.0alpha1~1381 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ba9576e7f2b67c0311352085fa961dc8fe69f0b4;p=postgis ST_ForceRHR POLYGON EMPTY crash (#710) git-svn-id: http://svn.osgeo.org/postgis/trunk@7446 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/liblwgeom/lwpoly.c b/liblwgeom/lwpoly.c index b05db7b2d..be6063ab0 100644 --- a/liblwgeom/lwpoly.c +++ b/liblwgeom/lwpoly.c @@ -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; inrings; i++) - { if ( ! ptarray_isccw(poly->rings[i]) ) - { ptarray_reverse(poly->rings[i]); - } - } + } void