Skip to content

Commit

Permalink
Do not cache expression nodes with eval errors
Browse files Browse the repository at this point in the history
When there is an evaluation error in an expression, there is no need to cache results.
With the previous approach, sometimes eval errors were not reported because the error was set to false (Null), evaluation triggered again but it didn't report any more eval errors because it was relying on cached values.
  • Loading branch information
m-kuhn committed Dec 27, 2017
1 parent e552b9b commit aa3bfff
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/core/expression/qgsexpressionnode.cpp
Expand Up @@ -14,6 +14,7 @@
***************************************************************************/

#include "qgsexpressionnode.h"
#include "qgsexpression.h"


QVariant QgsExpressionNode::eval( QgsExpression *parent, const QgsExpressionContext *context )
Expand All @@ -34,7 +35,10 @@ bool QgsExpressionNode::prepare( QgsExpression *parent, const QgsExpressionConte
if ( isStatic( parent, context ) )
{
mCachedStaticValue = evalNode( parent, context );
mHasCachedValue = true;
if ( !parent->hasEvalError() )
mHasCachedValue = true;
else
mHasCachedValue = false;
return true;
}
else
Expand Down

0 comments on commit aa3bfff

Please sign in to comment.