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 7, 2019
1 parent afaaabf commit 1b4e5925d36e0fb9309ce07979da68caf5b9c6d2
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 1b4e592

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