Skip to content

Commit

Permalink
Optimise retrieval of feature from context
Browse files Browse the repository at this point in the history
(cherry picked from commit 4113505)
  • Loading branch information
troopa81 authored and nyalldawson committed Mar 7, 2019
1 parent afaaabf commit 1b4e592
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/core/expression/qgsexpressionnodeimpl.cpp
Expand Up @@ -1237,13 +1237,16 @@ QVariant QgsExpressionNodeColumnRef::evalNode( QgsExpression *parent, const QgsE
}
}

if ( context && context->hasFeature() )
if ( context )
{
QgsFeature feature = context->feature();
if ( index >= 0 )
return feature.attribute( index );
else
return feature.attribute( mName );
if ( feature.isValid() )
{
if ( index >= 0 )
return feature.attribute( index );
else
return feature.attribute( mName );
}
}
return QVariant( '[' + mName + ']' );
}
Expand Down

0 comments on commit 1b4e592

Please sign in to comment.