[geos-commits] [SCM] GEOS branch 3.12 updated. eabf22113cc24416f6ae5df97bc7abc89bebff85

git at osgeo.org git at osgeo.org
Tue Nov 21 08:35:51 PST 2023


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, 3.12 has been updated
       via  eabf22113cc24416f6ae5df97bc7abc89bebff85 (commit)
      from  10254fe4493d7482769e935700410653e712b711 (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 eabf22113cc24416f6ae5df97bc7abc89bebff85
Author: Paul Ramsey <pramsey at cleverelephant.ca>
Date:   Tue Nov 21 08:04:37 2023 -0800

    Return 2D empty linestring on GEOSGeom_createLineString(NULL) (#998)
    
    References GH-993

diff --git a/src/geom/GeometryFactory.cpp b/src/geom/GeometryFactory.cpp
index d30ee4906..25b78613c 100644
--- a/src/geom/GeometryFactory.cpp
+++ b/src/geom/GeometryFactory.cpp
@@ -534,6 +534,8 @@ std::unique_ptr<LineString>
 GeometryFactory::createLineString(CoordinateSequence::Ptr && newCoords)
 const
 {
+    if (!newCoords)
+        return createLineString();
     // Can't use make_unique with protected constructor
     return std::unique_ptr<LineString>(new LineString(std::move(newCoords), *this));
 }
diff --git a/tests/unit/capi/GEOSGeom_createTest.cpp b/tests/unit/capi/GEOSGeom_createTest.cpp
index b2a2d7376..9b8afa520 100644
--- a/tests/unit/capi/GEOSGeom_createTest.cpp
+++ b/tests/unit/capi/GEOSGeom_createTest.cpp
@@ -11,13 +11,16 @@
 #include <cstdlib>
 #include <memory>
 
+#include "capi_test_utils.h"
+
 namespace tut {
 //
 // Test Group
 //
 
 // Common data used in test cases.
-struct test_capigeosgeom_create_data {
+struct test_capigeosgeom_create_data  : public capitest::utility
+{
     GEOSGeometry* geom1_;
     GEOSContextHandle_t handle_;
 
@@ -149,6 +152,14 @@ void object::test<7>
     geom1_ = nullptr;
 }
 
+template<>
+template<>
+void object::test<8>()
+{
+    input_ = GEOSGeom_createLineString(NULL);
+    ensure_equals(GEOSHasZ(input_), 0);
+    ensure_equals(GEOSHasM(input_), 0);
+}
 
 } // namespace tut
 
diff --git a/tests/unit/capi/GEOSHasZMTest.cpp b/tests/unit/capi/GEOSHasZMTest.cpp
index ff36ef7b2..346ca97d8 100644
--- a/tests/unit/capi/GEOSHasZMTest.cpp
+++ b/tests/unit/capi/GEOSHasZMTest.cpp
@@ -106,5 +106,6 @@ void object::test<9>()
     ensure_equals(GEOSHasM(input_), 1);
 }
 
+
 } // namespace tut
 

-----------------------------------------------------------------------

Summary of changes:
 src/geom/GeometryFactory.cpp            |  2 ++
 tests/unit/capi/GEOSGeom_createTest.cpp | 13 ++++++++++++-
 tests/unit/capi/GEOSHasZMTest.cpp       |  1 +
 3 files changed, 15 insertions(+), 1 deletion(-)


hooks/post-receive
-- 
GEOS


More information about the geos-commits mailing list