Skip to content
Permalink
Browse files

Optimise retrieval of feature from context

(cherry picked from commit 4113505)
  • Loading branch information
troopa81 authored and nyalldawson committed Mar 5, 2019
1 parent 71d0c8f commit 3b233bf0c4f164dd0a57c11b307645463a49e123
Showing with 8 additions and 5 deletions.
  1. +8 −5 src/core/expression/qgsexpressionnodeimpl.cpp
@@ -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 + ']' );
}

0 comments on commit 3b233bf

Please sign in to comment.
You can’t perform that action at this time.