Skip to content

Commit cb1e7d3

Browse files
committedJul 18, 2012
fix #6060
1 parent b463535 commit cb1e7d3

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed
 

‎src/core/qgsvectorlayer.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2410,22 +2410,23 @@ int QgsVectorLayer::splitFeatures( const QList<QgsPoint>& splitLine, bool topolo
24102410
QgsFeature newFeature;
24112411
newFeature.setGeometry( newGeometry );
24122412

2413-
//use default value where possible (primary key issue), otherwise the value from the original (splitted) feature
2414-
QgsAttributeMap newAttributes = select_it->attributeMap();
2415-
QVariant defaultValue;
2416-
for ( int j = 0; j < newAttributes.size(); ++j )
2413+
if ( mDataProvider )
24172414
{
2418-
if ( mDataProvider )
2415+
//use default value where possible (primary key issue), otherwise the value from the original (splitted) feature
2416+
QgsAttributeMap newAttributes = select_it->attributeMap();
2417+
QVariant defaultValue;
2418+
foreach( int j, newAttributes.keys() )
24192419
{
24202420
defaultValue = mDataProvider->defaultValue( j );
24212421
if ( !defaultValue.isNull() )
24222422
{
24232423
newAttributes.insert( j, defaultValue );
24242424
}
24252425
}
2426+
2427+
newFeature.setAttributeMap( newAttributes );
24262428
}
24272429

2428-
newFeature.setAttributeMap( newAttributes );
24292430
newFeatures.append( newFeature );
24302431
}
24312432

0 commit comments

Comments
 (0)
Please sign in to comment.