Skip to content
Permalink
Browse files

Do not cache expression nodes with eval errors

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 aa3bfff7a85c57c3dbf7bd6e59c9578b88baa87d
Showing with 5 additions and 1 deletion.
  1. +5 −1 src/core/expression/qgsexpressionnode.cpp
@@ -14,6 +14,7 @@
***************************************************************************/

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


QVariant QgsExpressionNode::eval( QgsExpression *parent, const QgsExpressionContext *context )
@@ -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

0 comments on commit aa3bfff

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