Navigation Menu

Skip to content

Commit

Permalink
Optimise retrieval of feature from context
Browse files Browse the repository at this point in the history
  • Loading branch information
troopa81 authored and nyalldawson committed Mar 3, 2019
1 parent c10e492 commit 4113505
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 4113505

Please sign in to comment.