Skip to content
Permalink
Browse files

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

(cherry picked from commit 518072e)
  • Loading branch information
jef-n committed Jun 1, 2015
1 parent 8b503a1 commit 9ef8b29f29aa23edf2e7603614e6277453670d94
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 9ef8b29

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