mirror of
https://github.com/qgis/QGIS.git
synced 2025-03-01 00:46:20 -05:00
expression: validate places value of format_number (fixes #12796)
This commit is contained in:
parent
239dc71d43
commit
518072e9b3
@ -1345,6 +1345,11 @@ static QVariant fcnFormatNumber( const QVariantList& values, const QgsFeature*,
|
||||
{
|
||||
double value = getDoubleValue( values.at( 0 ), parent );
|
||||
int places = getIntValue( values.at( 1 ), parent );
|
||||
if ( places < 0 )
|
||||
{
|
||||
parent->setEvalErrorString( QObject::tr( "Number of places must be positive" ) );
|
||||
return QVariant();
|
||||
}
|
||||
return QString( "%L1" ).arg( value, 0, 'f', places );
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user