Skip to content
Permalink
Browse files

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 ecae3c95194cb2ad25d791c4ffcf346ca80062fb
Showing with 12 additions and 9 deletions.
  1. +12 −9 src/core/qgsvectorlayereditbuffer.cpp
@@ -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;
}
}
}
}

1 comment on commit ecae3c9

@nyalldawson

This comment has been minimized.

Copy link
Collaborator

@nyalldawson nyalldawson commented on ecae3c9 Jul 5, 2017

@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.
You can’t perform that action at this time.