From f31932f8fd962fc36bcbc2cc5bd617508be3d52c Mon Sep 17 00:00:00 2001 From: Paul Ramsey Date: Tue, 10 Nov 2015 20:23:14 +0000 Subject: [PATCH] #3367, ST_RemoveRepeatedPoints fix for EMPTY geometry git-svn-id: http://svn.osgeo.org/postgis/trunk@14377 b70326c6-7e19-0410-871a-916f4a2858ee --- liblwgeom/lwgeom.c | 5 +++++ regress/tickets.sql | 2 ++ regress/tickets_expected | 1 + 3 files changed, 8 insertions(+) diff --git a/liblwgeom/lwgeom.c b/liblwgeom/lwgeom.c index f07b4ac15..08deb5d60 100644 --- a/liblwgeom/lwgeom.c +++ b/liblwgeom/lwgeom.c @@ -1409,6 +1409,11 @@ extern LWGEOM* lwgeom_remove_repeated_points(LWGEOM *in, double tolerance) LWDEBUGF(4, "lwgeom_remove_repeated_points got type %s", lwtype_name(in->type)); + if(lwgeom_is_empty(in)) + { + return lwgeom_clone_deep(in); + } + switch (in->type) { case MULTIPOINTTYPE: diff --git a/regress/tickets.sql b/regress/tickets.sql index 5a651eab6..03915fbb8 100644 --- a/regress/tickets.sql +++ b/regress/tickets.sql @@ -925,5 +925,7 @@ FROM (VALUES ( ('LINESTRING(124.983539 1.419224,91.181596 29.647798, 91.28 29.647)'::text ) ) As f(wkt) ORDER BY wkt; +SELECT '#3367', ST_AsText(ST_RemoveRepeatedPoints('POLYGON EMPTY'::geometry)); + -- Clean up DELETE FROM spatial_ref_sys; diff --git a/regress/tickets_expected b/regress/tickets_expected index a5daada14..69144dcf3 100644 --- a/regress/tickets_expected +++ b/regress/tickets_expected @@ -280,3 +280,4 @@ ERROR: invalid GML representation #3355|t #3356|LineString[] with 2 points|LineString[GS] with 2 points|LineString[GS] with 2 points #3356|LineString[B] with 3 points|LineString[BGS] with 3 points|LineString[BGS] with 3 points +#3367|POLYGON EMPTY -- 2.40.0