Skip to content

Commit

Permalink
Fix minimumValue for QgsVectorLayerSelectedFeatureSource
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Jul 5, 2018
1 parent ef6df0f commit 565980f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/core/qgsfeaturesource.cpp
Expand Up @@ -64,7 +64,7 @@ QVariant QgsFeatureSource::minimumValue( int fieldIndex ) const
while ( it.nextFeature( f ) )
{
QVariant v = f.attribute( fieldIndex );
if ( v.isValid() && qgsVariantLessThan( v, min ) )
if ( !v.isNull() && ( qgsVariantLessThan( v, min ) || min.isNull() ) )
{
min = v;
}
Expand All @@ -87,7 +87,7 @@ QVariant QgsFeatureSource::maximumValue( int fieldIndex ) const
while ( it.nextFeature( f ) )
{
QVariant v = f.attribute( fieldIndex );
if ( v.isValid() && qgsVariantGreaterThan( v, max ) )
if ( !v.isNull() && ( qgsVariantGreaterThan( v, max ) || max.isNull() ) )
{
max = v;
}
Expand Down

0 comments on commit 565980f

Please sign in to comment.