diff --git a/src/core/qgsexpression.cpp b/src/core/qgsexpression.cpp old mode 100644 new mode 100755 index d296fc5ebfe1..69f840e2b5f4 --- a/src/core/qgsexpression.cpp +++ b/src/core/qgsexpression.cpp @@ -87,7 +87,7 @@ inline bool isDoubleSafe( const QVariant& v ) return false; } -inline bool isNull( const QVariant& v ) { return v.type() == QVariant::Invalid; } +inline bool isNull( const QVariant& v ) { return v.isNull(); } /////////////////////////////////////////////// // evaluation error macros @@ -149,7 +149,7 @@ static int getIntValue( const QVariant& value, QgsExpression* parent ) static TVL getTVLValue( const QVariant& value, QgsExpression* parent ) { // we need to convert to TVL - if ( value.type() == QVariant::Invalid ) + if ( value.isNull() ) return Unknown; if ( value.type() == QVariant::Int ) @@ -928,13 +928,15 @@ bool QgsExpression::NodeLiteral::prepare( QgsExpression* /*parent*/, const QgsFi QString QgsExpression::NodeLiteral::dump() const { + if ( mValue.isNull() ) + return "NULL"; + switch ( mValue.type() ) { - case QVariant::Invalid: return "NULL"; case QVariant::Int: return QString::number( mValue.toInt() ); case QVariant::Double: return QString::number( mValue.toDouble() ); case QVariant::String: return QString( "'%1'" ).arg( mValue.toString() ); - default: return "[unsupported value]"; + default: return QString( "[unsupported type;%1; value:%2]" ).arg( mValue.typeName() ).arg( mValue.toString() ); } } diff --git a/src/core/qgspallabeling.cpp b/src/core/qgspallabeling.cpp index 66c4f2be72d5..8bb0170b6256 100644 --- a/src/core/qgspallabeling.cpp +++ b/src/core/qgspallabeling.cpp @@ -463,7 +463,7 @@ void QgsPalLayerSettings::registerFeature( QgsVectorLayer* layer, QgsFeature& f QgsDebugMsg( "Expression parser error:" + exp->parserErrorString() ); return; } - QVariant result = exp->evaluate( &f, layer->dataProvider()->fields() ); + QVariant result = exp->evaluate( &f, layer->pendingFields() ); if ( exp->hasEvalError() ) { QgsDebugMsg( "Expression parser eval error:" + exp->evalErrorString() );