Skip to content

Commit

Permalink
Cache field lookup when evaluating field-based property values
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Dec 2, 2017
1 parent d1a71f0 commit c5f6535
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/core/qgsproperty.cpp
Expand Up @@ -448,14 +448,13 @@ QVariant QgsProperty::propertyValue( const QgsExpressionContext &context, const
*ok = true;
return f.attribute( d->cachedFieldIdx );
}

int fieldIdx = f.fieldNameIndex( d->fieldName );
if ( fieldIdx < 0 )
prepare( context );
if ( d->cachedFieldIdx < 0 )
return defaultValue;

if ( ok )
*ok = true;
return f.attribute( fieldIdx );
return f.attribute( d->cachedFieldIdx );
}

case ExpressionBasedProperty:
Expand Down

0 comments on commit c5f6535

Please sign in to comment.