Skip to content

Commit d62eb6e

Browse files
committed
get in every case if not valid the copy of the value
even if unique constraint because it checks if existent - otherwise it get's null there
1 parent e8c15a9 commit d62eb6e

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/core/qgsvectorlayerutils.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -424,6 +424,14 @@ QgsFeature QgsVectorLayerUtils::createFeature( const QgsVectorLayer *layer, cons
424424
}
425425
}
426426

427+
// 5. passed attribute value
428+
// note - deliberately not using else if!
429+
if ( !v.isValid() && attributes.contains( idx ) )
430+
{
431+
v = attributes.value( idx );
432+
}
433+
434+
427435
// last of all... check that unique constraints are respected
428436
// we can't handle not null or expression constraints here, since there's no way to pick a sensible
429437
// value if the constraint is violated

0 commit comments

Comments
 (0)