Skip to content
Permalink
Browse files

expression: validate places value of format_number (fixes #12796)

  • Loading branch information
jef-n committed Jun 1, 2015
1 parent 239dc71 commit 518072e9b319fa15848237b2a42a472421a40627
Showing with 5 additions and 0 deletions.
  1. +5 −0 src/core/qgsexpression.cpp
@@ -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 );
}

0 comments on commit 518072e

Please sign in to comment.
You can’t perform that action at this time.