[geos-commits] [SCM] GEOS branch main updated. 5e44ec3f6d46693a95465e230726220938752a0d
git at osgeo.org
git at osgeo.org
Fri Oct 29 14:43:52 PDT 2021
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GEOS".
The branch, main has been updated
via 5e44ec3f6d46693a95465e230726220938752a0d (commit)
from 2b426f7118b5d0a8a1e4492d8ee75b4cc03889ad (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 5e44ec3f6d46693a95465e230726220938752a0d
Author: Paul Ramsey <pramsey at cleverelephant.ca>
Date: Fri Oct 29 14:33:35 2021 -0700
Check for empty Sequence when collapsing linear ring. References #1135
diff --git a/src/geom/util/GeometryTransformer.cpp b/src/geom/util/GeometryTransformer.cpp
index faa7f8f3f..19c4bd5f0 100644
--- a/src/geom/util/GeometryTransformer.cpp
+++ b/src/geom/util/GeometryTransformer.cpp
@@ -202,7 +202,7 @@ GeometryTransformer::transformLinearRing(
CoordinateSequence::Ptr seq(transformCoordinates(
geom->getCoordinatesRO(), geom));
- auto seqSize = seq->size();
+ std::size_t seqSize = seq ? seq->size() : 0;
// ensure a valid LinearRing
if(seqSize > 0 && seqSize < 4 && ! preserveType) {
diff --git a/tests/unit/capi/GEOSGeom_setPrecisionTest.cpp b/tests/unit/capi/GEOSGeom_setPrecisionTest.cpp
index 06f4148fa..4864d02a0 100644
--- a/tests/unit/capi/GEOSGeom_setPrecisionTest.cpp
+++ b/tests/unit/capi/GEOSGeom_setPrecisionTest.cpp
@@ -158,5 +158,16 @@ void object::test<9> ()
ensure_geometry_equals(geom2_, "LINESTRING (0 0, 0 0)");
}
+
+// Collapse a linearRing / Trac #1135
+template<>
+template<>
+void object::test<10> ()
+{
+ geom1_ = fromWKT("LINEARRING (0 0, 0.1 0, 0.1 0.1, 0 0.1, 0 0)");
+ geom2_ = GEOSGeom_setPrecision(geom1_, 1.0, 0);
+ ensure_geometry_equals(geom2_, "LINEARRING EMPTY");
+}
+
} // namespace tut
-----------------------------------------------------------------------
Summary of changes:
src/geom/util/GeometryTransformer.cpp | 2 +-
tests/unit/capi/GEOSGeom_setPrecisionTest.cpp | 11 +++++++++++
2 files changed, 12 insertions(+), 1 deletion(-)
hooks/post-receive
--
GEOS
More information about the geos-commits
mailing list