mirror of
https://github.com/qgis/QGIS.git
synced 2025-03-26 00:08:20 -04:00
Removed redundant check for isValid
This commit is contained in:
parent
2604fc70c5
commit
4250ef249a
@ -494,7 +494,7 @@ QgsFeatureList QgsVectorLayerUtils::createFeatures( const QgsVectorLayer *layer,
|
|||||||
|
|
||||||
// 2. client side default expression
|
// 2. client side default expression
|
||||||
// note - deliberately not using else if!
|
// note - deliberately not using else if!
|
||||||
if ( ( ! v.isValid() || v.isNull() || ( hasUniqueConstraint
|
if ( ( v.isNull() || ( hasUniqueConstraint
|
||||||
&& uniqueValueCaches[ idx ].contains( v ) ) )
|
&& uniqueValueCaches[ idx ].contains( v ) ) )
|
||||||
&& layer->defaultValueDefinition( idx ).isValid() )
|
&& layer->defaultValueDefinition( idx ).isValid() )
|
||||||
{
|
{
|
||||||
@ -506,7 +506,7 @@ QgsFeatureList QgsVectorLayerUtils::createFeatures( const QgsVectorLayer *layer,
|
|||||||
|
|
||||||
// 3. provider side default value clause
|
// 3. provider side default value clause
|
||||||
// note - not an else if deliberately. Users may return null from a default value expression to fallback to provider defaults
|
// note - not an else if deliberately. Users may return null from a default value expression to fallback to provider defaults
|
||||||
if ( ( ! v.isValid() || v.isNull() || ( hasUniqueConstraint
|
if ( ( v.isNull() || ( hasUniqueConstraint
|
||||||
&& uniqueValueCaches[ idx ].contains( v ) ) )
|
&& uniqueValueCaches[ idx ].contains( v ) ) )
|
||||||
&& fields.fieldOrigin( idx ) == QgsFields::OriginProvider )
|
&& fields.fieldOrigin( idx ) == QgsFields::OriginProvider )
|
||||||
{
|
{
|
||||||
@ -521,7 +521,7 @@ QgsFeatureList QgsVectorLayerUtils::createFeatures( const QgsVectorLayer *layer,
|
|||||||
|
|
||||||
// 4. provider side default literal
|
// 4. provider side default literal
|
||||||
// note - deliberately not using else if!
|
// note - deliberately not using else if!
|
||||||
if ( ( ! v.isValid() || v.isNull() || ( checkUnique && hasUniqueConstraint
|
if ( ( v.isNull() || ( checkUnique && hasUniqueConstraint
|
||||||
&& uniqueValueCaches[ idx ].contains( v ) ) )
|
&& uniqueValueCaches[ idx ].contains( v ) ) )
|
||||||
&& fields.fieldOrigin( idx ) == QgsFields::OriginProvider )
|
&& fields.fieldOrigin( idx ) == QgsFields::OriginProvider )
|
||||||
{
|
{
|
||||||
@ -536,7 +536,7 @@ QgsFeatureList QgsVectorLayerUtils::createFeatures( const QgsVectorLayer *layer,
|
|||||||
|
|
||||||
// 5. passed attribute value
|
// 5. passed attribute value
|
||||||
// note - deliberately not using else if!
|
// note - deliberately not using else if!
|
||||||
if ( ( !v.isValid() || v.isNull() ) && fd.attributes().contains( idx ) )
|
if ( v.isNull() && fd.attributes().contains( idx ) )
|
||||||
{
|
{
|
||||||
v = fd.attributes().value( idx );
|
v = fd.attributes().value( idx );
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user