Skip to content

Commit

Permalink
Skip check if value is NULL
Browse files Browse the repository at this point in the history
  • Loading branch information
elpaso authored and nyalldawson committed Jun 19, 2020
1 parent f3bbc4d commit fb9de10
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/core/providers/memory/qgsmemoryprovider.cpp
Expand Up @@ -419,12 +419,12 @@ bool QgsMemoryProvider::addFeatures( QgsFeatureList &flist, Flags )
continue;
}

// Check attribute types
// Check attribute conversion
bool conversionError { false };
for ( int i = 0; i < mFields.count() && ! conversionError; ++i )
{
QVariant attrValue { it->attribute( i ) };
if ( ! mFields.at( i ).convertCompatible( attrValue ) )
if ( ! attrValue.isNull() && ! mFields.at( i ).convertCompatible( attrValue ) )
{
pushError( tr( "Could not add feature with attribute %1 having type %2, cannot convert to type %3" )
.arg( mFields.at( i ).name(), it->attribute( i ).typeName(), mFields.at( i ).typeName() ) );
Expand Down

0 comments on commit fb9de10

Please sign in to comment.