Skip to content

Commit 16f1504

Browse files
committed
Fix minimumValue for QgsVectorLayerSelectedFeatureSource
(cherry-picked from 565980f)
1 parent 6659f22 commit 16f1504

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/core/qgsfeaturesource.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ QVariant QgsFeatureSource::minimumValue( int fieldIndex ) const
5959
while ( it.nextFeature( f ) )
6060
{
6161
QVariant v = f.attribute( fieldIndex );
62-
if ( v.isValid() && qgsVariantLessThan( v, min ) )
62+
if ( !v.isNull() && ( qgsVariantLessThan( v, min ) || min.isNull() ) )
6363
{
6464
min = v;
6565
}
@@ -82,7 +82,7 @@ QVariant QgsFeatureSource::maximumValue( int fieldIndex ) const
8282
while ( it.nextFeature( f ) )
8383
{
8484
QVariant v = f.attribute( fieldIndex );
85-
if ( v.isValid() && qgsVariantGreaterThan( v, max ) )
85+
if ( !v.isNull() && ( qgsVariantGreaterThan( v, max ) || max.isNull() ) )
8686
{
8787
max = v;
8888
}

0 commit comments

Comments
 (0)