Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix crash when repairing zero length linestring geometry
Fixes #18077
  • Loading branch information
nyalldawson committed Feb 12, 2018
1 parent 0eda776 commit 5431a2d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/core/geometry/qgsgeometrymakevalid.cpp
Expand Up @@ -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 );

Expand Down
3 changes: 3 additions & 0 deletions tests/src/core/testqgsgeometry.cpp
Expand Up @@ -15984,6 +15984,9 @@ void TestQgsGeometry::makeValid()
// 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 )
{
Expand Down

0 comments on commit 5431a2d

Please sign in to comment.