Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix minimumValue for QgsVectorLayerSelectedFeatureSource
(cherry-picked from 565980f)
  • Loading branch information
nyalldawson committed Jul 10, 2018
1 parent 6659f22 commit 16f1504
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/core/qgsfeaturesource.cpp
Expand Up @@ -59,7 +59,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 @@ -82,7 +82,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 16f1504

Please sign in to comment.