Skip to content

Commit 272a02d

Browse files
committed
Min/max exp functions have custom Null handler
1 parent c063710 commit 272a02d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/core/expression/qgsexpressionfunction.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ static QVariant fcnExpScale( const QVariantList &values, const QgsExpressionCont
415415

416416
static QVariant fcnMax( const QVariantList &values, const QgsExpressionContext *, QgsExpression *parent, const QgsExpressionNodeFunction * )
417417
{
418-
QVariant result;
418+
QVariant result( QVariant::Double );
419419
double maxVal = std::numeric_limits<double>::quiet_NaN();
420420
for ( const QVariant &val : values )
421421
{
@@ -439,7 +439,7 @@ static QVariant fcnMax( const QVariantList &values, const QgsExpressionContext *
439439

440440
static QVariant fcnMin( const QVariantList &values, const QgsExpressionContext *, QgsExpression *parent, const QgsExpressionNodeFunction * )
441441
{
442-
QVariant result;
442+
QVariant result( QVariant::Double );
443443
double minVal = std::numeric_limits<double>::quiet_NaN();
444444
for ( const QVariant &val : values )
445445
{
@@ -3941,8 +3941,8 @@ const QList<QgsExpressionFunction *> &QgsExpression::Functions()
39413941
sFunctions << randfFunc;
39423942

39433943
sFunctions
3944-
<< new QgsStaticExpressionFunction( QStringLiteral( "max" ), -1, fcnMax, QStringLiteral( "Math" ) )
3945-
<< new QgsStaticExpressionFunction( QStringLiteral( "min" ), -1, fcnMin, QStringLiteral( "Math" ) )
3944+
<< new QgsStaticExpressionFunction( QStringLiteral( "max" ), -1, fcnMax, QStringLiteral( "Math" ), QString(), false, QSet<QString>(), false, QStringList(), /* handlesNull = */ true )
3945+
<< new QgsStaticExpressionFunction( QStringLiteral( "min" ), -1, fcnMin, QStringLiteral( "Math" ), QString(), false, QSet<QString>(), false, QStringList(), /* handlesNull = */ true )
39463946
<< new QgsStaticExpressionFunction( QStringLiteral( "clamp" ), QgsExpressionFunction::ParameterList() << QgsExpressionFunction::Parameter( QStringLiteral( "min" ) ) << QgsExpressionFunction::Parameter( QStringLiteral( "value" ) ) << QgsExpressionFunction::Parameter( QStringLiteral( "max" ) ), fcnClamp, QStringLiteral( "Math" ) )
39473947
<< new QgsStaticExpressionFunction( QStringLiteral( "scale_linear" ), 5, fcnLinearScale, QStringLiteral( "Math" ) )
39483948
<< new QgsStaticExpressionFunction( QStringLiteral( "scale_exp" ), 6, fcnExpScale, QStringLiteral( "Math" ) )

0 commit comments

Comments
 (0)