Skip to content

Commit

Permalink
Only convert geometries to provider type when provider does strict ty…
Browse files Browse the repository at this point in the history
…pe checking

(ie. not for shapes; fixes qgis#16593, qgis#16784, qgis#16792, qgis#16770;
followup 87116ab; forward ported from d19ed1c)
  • Loading branch information
jef-n committed Jul 5, 2017
1 parent 5b8e2c2 commit ecae3c9
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions src/core/qgsvectorlayereditbuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -318,17 +318,20 @@ bool QgsVectorLayerEditBuffer::commitChanges( QStringList &commitErrors )
{
if ( cap & QgsVectorDataProvider::AddFeatures )
{
for ( QgsFeature f : mAddedFeatures )
if ( provider->doesStrictFeatureTypeCheck() )
{
if ( ( ! f.hasGeometry() ) ||
( f.geometry().wkbType() == provider->wkbType() ) )
continue;

if ( provider->convertToProviderType( f.geometry() ).isNull() )
for ( QgsFeature f : mAddedFeatures )
{
commitErrors << tr( "ERROR: %n feature(s) not added - geometry type is not compatible with the current layer.", "not added features count", mAddedFeatures.size() );
success = false;
break;
if ( ( ! f.hasGeometry() ) ||
( f.geometry().wkbType() == provider->wkbType() ) )
continue;

if ( provider->convertToProviderType( f.geometry() ).isNull() )
{
commitErrors << tr( "ERROR: %n feature(s) not added - geometry type is not compatible with the current layer.", "not added features count", mAddedFeatures.size() );
success = false;
break;
}
}
}
}
Expand Down

0 comments on commit ecae3c9

Please sign in to comment.