Skip to content
Permalink
Browse files
fix #4622
  • Loading branch information
jef-n committed Jan 8, 2012
1 parent 7f7f61e commit 18451fdb0267f6c6fbae692a43346b9145e68052
Showing with 8 additions and 3 deletions.
  1. +8 −3 src/core/qgsexpression.cpp
@@ -18,7 +18,9 @@
#include <QtDebug>
#include <QDomDocument>
#include <QSettings>

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

#include "qgsdistancearea.h"
#include "qgsfeature.h"
@@ -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;
}


0 comments on commit 18451fd

Please sign in to comment.