Skip to content

Commit 565980f

Browse files
committed
Fix minimumValue for QgsVectorLayerSelectedFeatureSource
1 parent ef6df0f commit 565980f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/core/qgsfeaturesource.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ QVariant QgsFeatureSource::minimumValue( int fieldIndex ) const
6464
while ( it.nextFeature( f ) )
6565
{
6666
QVariant v = f.attribute( fieldIndex );
67-
if ( v.isValid() && qgsVariantLessThan( v, min ) )
67+
if ( !v.isNull() && ( qgsVariantLessThan( v, min ) || min.isNull() ) )
6868
{
6969
min = v;
7070
}
@@ -87,7 +87,7 @@ QVariant QgsFeatureSource::maximumValue( int fieldIndex ) const
8787
while ( it.nextFeature( f ) )
8888
{
8989
QVariant v = f.attribute( fieldIndex );
90-
if ( v.isValid() && qgsVariantGreaterThan( v, max ) )
90+
if ( !v.isNull() && ( qgsVariantGreaterThan( v, max ) || max.isNull() ) )
9191
{
9292
max = v;
9393
}

0 commit comments

Comments
 (0)