Skip to content
Permalink
Browse files

Fix crash when repairing zero length linestring geometry

Fixes #18077
  • Loading branch information
nyalldawson committed Feb 12, 2018
1 parent 0eda776 commit 5431a2dbaece3902b6bf906b86b3c4257062630d
Showing with 4 additions and 1 deletion.
  1. +1 −1 src/core/geometry/qgsgeometrymakevalid.cpp
  2. +3 −0 tests/src/core/testqgsgeometry.cpp
@@ -716,7 +716,7 @@ static GEOSGeometry *LWGEOM_GEOS_makeValidMultiLine( const GEOSGeometry *gin, QS
int ngeoms = GEOSGetNumGeometries_r( handle, gin );
uint32_t nlines_alloc = ngeoms;
QVector<GEOSGeometry *> lines;
QVector<GEOSGeometry *> points( ngeoms );
QVector<GEOSGeometry *> points;
lines.reserve( nlines_alloc );
points.reserve( ngeoms );

// collection with invalid geometries
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))" ),
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)))" ) );
// null line (#18077)
geoms << qMakePair( QStringLiteral( "MultiLineString ((356984.0625 6300089, 356984.0625 6300089))" ),
QStringLiteral( "MultiPoint ((356984.0625 6300089))" ) );

Q_FOREACH ( const InputAndExpectedWktPair &pair, geoms )
{

0 comments on commit 5431a2d

Please sign in to comment.
You can’t perform that action at this time.