@@ -494,8 +494,8 @@ QgsFeatureList QgsVectorLayerUtils::createFeatures( const QgsVectorLayer *layer,
494
494
495
495
// 2. client side default expression
496
496
// note - deliberately not using else if!
497
- if ( ( ! v. isValid () || v.isNull () || ( hasUniqueConstraint
498
- && uniqueValueCaches[ idx ].contains ( v ) ) )
497
+ if ( ( v.isNull () || ( hasUniqueConstraint
498
+ && uniqueValueCaches[ idx ].contains ( v ) ) )
499
499
&& layer->defaultValueDefinition ( idx ).isValid () )
500
500
{
501
501
// client side default expression set - takes precedence over all. Why? Well, this is the only default
@@ -506,8 +506,8 @@ QgsFeatureList QgsVectorLayerUtils::createFeatures( const QgsVectorLayer *layer,
506
506
507
507
// 3. provider side default value clause
508
508
// note - not an else if deliberately. Users may return null from a default value expression to fallback to provider defaults
509
- if ( ( ! v. isValid () || v.isNull () || ( hasUniqueConstraint
510
- && uniqueValueCaches[ idx ].contains ( v ) ) )
509
+ if ( ( v.isNull () || ( hasUniqueConstraint
510
+ && uniqueValueCaches[ idx ].contains ( v ) ) )
511
511
&& fields.fieldOrigin ( idx ) == QgsFields::OriginProvider )
512
512
{
513
513
int providerIndex = fields.fieldOriginIndex ( idx );
@@ -521,8 +521,8 @@ QgsFeatureList QgsVectorLayerUtils::createFeatures( const QgsVectorLayer *layer,
521
521
522
522
// 4. provider side default literal
523
523
// note - deliberately not using else if!
524
- if ( ( ! v. isValid () || v.isNull () || ( checkUnique && hasUniqueConstraint
525
- && uniqueValueCaches[ idx ].contains ( v ) ) )
524
+ if ( ( v.isNull () || ( checkUnique && hasUniqueConstraint
525
+ && uniqueValueCaches[ idx ].contains ( v ) ) )
526
526
&& fields.fieldOrigin ( idx ) == QgsFields::OriginProvider )
527
527
{
528
528
int providerIndex = fields.fieldOriginIndex ( idx );
@@ -536,7 +536,7 @@ QgsFeatureList QgsVectorLayerUtils::createFeatures( const QgsVectorLayer *layer,
536
536
537
537
// 5. passed attribute value
538
538
// note - deliberately not using else if!
539
- if ( ( !v. isValid () || v. isNull () ) && fd.attributes ().contains ( idx ) )
539
+ if ( v. isNull () && fd.attributes ().contains ( idx ) )
540
540
{
541
541
v = fd.attributes ().value ( idx );
542
542
}
0 commit comments