]> granicus.if.org Git - postgis/commitdiff
Handled NULL returns from getCentroid making it an EMPTY GEOM
authorSandro Santilli <strk@keybit.net>
Thu, 30 Dec 2004 13:35:50 +0000 (13:35 +0000)
committerSandro Santilli <strk@keybit.net>
Thu, 30 Dec 2004 13:35:50 +0000 (13:35 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@1193 b70326c6-7e19-0410-871a-916f4a2858ee

lwgeom/lwgeom_geos_wrapper.cpp

index 2745bc5fd2d44e2180f606df1ea7f0a3647a9051..355bfe5611728e3cc057471d449319709424f08e 100644 (file)
@@ -1587,7 +1587,11 @@ const Geometry *GEOSGetInteriorRingN(Geometry *g1,int n)
 Geometry *GEOSGetCentroid(Geometry *g)
 {
        try{
-               return g->getCentroid();
+               Geometry *ret = g->getCentroid();
+               if ( ret == NULL ) {
+                       ret = geomFactory->createGeometryCollection();
+               }
+               return ret;
        }
        catch (GEOSException *ge)
        {
@@ -1595,7 +1599,6 @@ Geometry *GEOSGetCentroid(Geometry *g)
                delete ge;
                return NULL;
        }
-
        catch(...)
        {
                return NULL;