Skip to content

Commit 5431a2d

Browse files
committed
Fix crash when repairing zero length linestring geometry
Fixes #18077
1 parent 0eda776 commit 5431a2d

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/core/geometry/qgsgeometrymakevalid.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -716,7 +716,7 @@ static GEOSGeometry *LWGEOM_GEOS_makeValidMultiLine( const GEOSGeometry *gin, QS
716716
int ngeoms = GEOSGetNumGeometries_r( handle, gin );
717717
uint32_t nlines_alloc = ngeoms;
718718
QVector<GEOSGeometry *> lines;
719-
QVector<GEOSGeometry *> points( ngeoms );
719+
QVector<GEOSGeometry *> points;
720720
lines.reserve( nlines_alloc );
721721
points.reserve( ngeoms );
722722

tests/src/core/testqgsgeometry.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -15984,6 +15984,9 @@ void TestQgsGeometry::makeValid()
1598415984
// collection with invalid geometries
1598515985
geoms << qMakePair( QStringLiteral( "GEOMETRYCOLLECTION(LINESTRING(0 0, 0 0), POLYGON((0 0, 10 10, 10 0, 0 10, 0 0)), LINESTRING(10 0, 10 10))" ),
1598615986
QStringLiteral( "GEOMETRYCOLLECTION(POINT(0 0), MULTIPOLYGON(((5 5, 0 0, 0 10, 5 5)),((5 5, 10 10, 10 0, 5 5))), LINESTRING(10 0, 10 10)))" ) );
15987+
// null line (#18077)
15988+
geoms << qMakePair( QStringLiteral( "MultiLineString ((356984.0625 6300089, 356984.0625 6300089))" ),
15989+
QStringLiteral( "MultiPoint ((356984.0625 6300089))" ) );
1598715990

1598815991
Q_FOREACH ( const InputAndExpectedWktPair &pair, geoms )
1598915992
{

0 commit comments

Comments
 (0)