Skip to content

Commit

Permalink
Fix single parameter version of represent_value
Browse files Browse the repository at this point in the history
Fix #17407
  • Loading branch information
m-kuhn committed Nov 7, 2017
1 parent 07cef67 commit 5595f40
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/core/expression/qgsexpressionfunction.cpp
Expand Up @@ -3435,15 +3435,13 @@ static QVariant fcnRepresentValue( const QVariantList &values, const QgsExpressi
{
QVariant result;
QString fieldName;
if ( values.size() == 1 )
if ( !values.isEmpty() )
{
QgsExpressionNodeColumnRef *col = dynamic_cast<QgsExpressionNodeColumnRef *>( node->args()->at( 0 ) );
if ( col )
if ( col && ( values.size() == 1 || !values.at( 1 ).isValid() ) )
fieldName = col->name();
}
else
{
fieldName = QgsExpressionUtils::getStringValue( values.at( 1 ), parent );
else if ( values.size() == 2 )
fieldName = QgsExpressionUtils::getStringValue( values.at( 1 ), parent );
}
QVariant value = values.at( 0 );

Expand Down

0 comments on commit 5595f40

Please sign in to comment.