Skip to content
Permalink
Browse files
Fix crash in geometry checker when empty geometries are found
Fixes #38983
  • Loading branch information
nyalldawson authored and github-actions committed Jun 10, 2021
1 parent 607b44b commit f31405ea9c1589f4bfc909c095229f9a25debf85
@@ -35,7 +35,7 @@ QgsVectorDataProviderFeaturePool::QgsVectorDataProviderFeaturePool( QgsVectorLay
QgsFeatureIterator it = layer->getFeatures( req );
while ( it.nextFeature( feature ) )
{
if ( feature.hasGeometry() )
if ( feature.hasGeometry() && !feature.geometry().isEmpty() )
{
insertFeature( feature );
featureIds.insert( feature.id() );
@@ -408,6 +408,7 @@ void TestQgsGeometryChecks::testDuplicateCheck()
layers.insert( "point_layer.shp", "" );
layers.insert( "line_layer.shp", "" );
layers.insert( "polygon_layer.shp", "" );
layers.insert( "polygon_layer_empty_geometries.geojson", "" );
auto testContext = createTestContext( dir, layers );

// Test detection
@@ -0,0 +1,11 @@
{
"type": "FeatureCollection",
"name": "polygon_layer_empty_geometries",
"crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:OGC:1.3:CRS84" } },
"features": [
{ "type": "Feature", "properties": { "id": 8, "attr": null }, "geometry": { "type": "MultiPolygon", "coordinates": [ ] } },
{ "type": "Feature", "properties": { "id": 9, "attr": null }, "geometry": { "type": "MultiPolygon", "coordinates": [ ] } },
{ "type": "Feature", "properties": { "id": 10, "attr": null }, "geometry": { "type": "MultiPolygon", "coordinates": [ ] } },
{ "type": "Feature", "properties": { "id": null, "attr": 5 }, "geometry": { "type": "MultiPolygon", "coordinates": [ [ [ [ -0.683682008368201, 0.502928870292887 ], [ -0.1581589958159, -0.104602510460251 ], [ -0.700418410041841, -0.091213389121339 ], [ -0.683682008368201, 0.502928870292887 ] ] ] ] } }
]
}

0 comments on commit f31405e

Please sign in to comment.