Skip to content

Commit

Permalink
Fix isIntSafe and isDoubleSafe not considering QVariant::UInt, QVaria…
Browse files Browse the repository at this point in the history
…nt::LongLong, QVariant::ULongLong (Funded by Sourcepole)
  • Loading branch information
manisandro committed Dec 1, 2014
1 parent 974511f commit 29d0166
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/core/qgsexpression.cpp
Expand Up @@ -162,13 +162,20 @@ static QVariant tvl2variant( TVL v )
inline bool isIntSafe( const QVariant& v )
{
if ( v.type() == QVariant::Int ) return true;
if ( v.type() == QVariant::UInt ) return true;
if ( v.type() == QVariant::LongLong ) return true;
if ( v.type() == QVariant::ULongLong ) return true;
if ( v.type() == QVariant::Double ) return false;
if ( v.type() == QVariant::String ) { bool ok; v.toString().toInt( &ok ); return ok; }
return false;
}
inline bool isDoubleSafe( const QVariant& v )
{
if ( v.type() == QVariant::Double || v.type() == QVariant::Int ) return true;
if ( v.type() == QVariant::Double ) return true;
if ( v.type() == QVariant::Int ) return true;
if ( v.type() == QVariant::UInt ) return true;
if ( v.type() == QVariant::LongLong ) return true;
if ( v.type() == QVariant::ULongLong ) return true;
if ( v.type() == QVariant::String ) { bool ok; v.toString().toDouble( &ok ); return ok; }
return false;
}
Expand Down

0 comments on commit 29d0166

Please sign in to comment.