Skip to content

Commit

Permalink
fix #4622
Browse files Browse the repository at this point in the history
  • Loading branch information
jef-n committed Jan 8, 2012
1 parent 7f7f61e commit 18451fd
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/core/qgsexpression.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
#include <QtDebug>
#include <QDomDocument>
#include <QSettings>

#include <math.h>
#include <limits>

#include "qgsdistancearea.h"
#include "qgsfeature.h"
Expand Down Expand Up @@ -136,13 +138,16 @@ static double getDoubleValue( const QVariant& value, QgsExpression* parent )
static int getIntValue( const QVariant& value, QgsExpression* parent )
{
bool ok;
int x = value.toInt( &ok );
if ( !ok )
qint64 x = value.toLongLong(&ok);
if ( ok && x >= std::numeric_limits<int>::min() && x <= std::numeric_limits<int>::max() )
{
return x;
}
else
{
parent->setEvalErrorString( QObject::tr( "Cannot convert '%1' to int" ).arg( value.toString() ) );
return 0;
}
return x;
}


Expand Down

0 comments on commit 18451fd

Please sign in to comment.