Skip to content

Commit 4250ef2

Browse files
committed
Removed redundant check for isValid
1 parent 2604fc7 commit 4250ef2

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/core/qgsvectorlayerutils.cpp

+7-7
Original file line numberDiff line numberDiff line change
@@ -494,8 +494,8 @@ QgsFeatureList QgsVectorLayerUtils::createFeatures( const QgsVectorLayer *layer,
494494

495495
// 2. client side default expression
496496
// 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 ) ) )
499499
&& layer->defaultValueDefinition( idx ).isValid() )
500500
{
501501
// 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,
506506

507507
// 3. provider side default value clause
508508
// 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 ) ) )
511511
&& fields.fieldOrigin( idx ) == QgsFields::OriginProvider )
512512
{
513513
int providerIndex = fields.fieldOriginIndex( idx );
@@ -521,8 +521,8 @@ QgsFeatureList QgsVectorLayerUtils::createFeatures( const QgsVectorLayer *layer,
521521

522522
// 4. provider side default literal
523523
// 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 ) ) )
526526
&& fields.fieldOrigin( idx ) == QgsFields::OriginProvider )
527527
{
528528
int providerIndex = fields.fieldOriginIndex( idx );
@@ -536,7 +536,7 @@ QgsFeatureList QgsVectorLayerUtils::createFeatures( const QgsVectorLayer *layer,
536536

537537
// 5. passed attribute value
538538
// note - deliberately not using else if!
539-
if ( ( !v.isValid() || v.isNull() ) && fd.attributes().contains( idx ) )
539+
if ( v.isNull() && fd.attributes().contains( idx ) )
540540
{
541541
v = fd.attributes().value( idx );
542542
}

0 commit comments

Comments
 (0)