Skip to content

Commit

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

(ie. not for shapes; fixes #16593, #16784, #16792, #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
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

1 comment on commit ecae3c9

@nyalldawson
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@luipir the usual response here is to deny all responsibility, blame the regression on the lack of an existing unit test, and then add one as penance ;)

Please sign in to comment.