Skip to content

Commit aa3bfff

Browse files
committedDec 27, 2017
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.
1 parent e552b9b commit aa3bfff

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed
 

‎src/core/expression/qgsexpressionnode.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
***************************************************************************/
1515

1616
#include "qgsexpressionnode.h"
17+
#include "qgsexpression.h"
1718

1819

1920
QVariant QgsExpressionNode::eval( QgsExpression *parent, const QgsExpressionContext *context )
@@ -34,7 +35,10 @@ bool QgsExpressionNode::prepare( QgsExpression *parent, const QgsExpressionConte
3435
if ( isStatic( parent, context ) )
3536
{
3637
mCachedStaticValue = evalNode( parent, context );
37-
mHasCachedValue = true;
38+
if ( !parent->hasEvalError() )
39+
mHasCachedValue = true;
40+
else
41+
mHasCachedValue = false;
3842
return true;
3943
}
4044
else

0 commit comments

Comments
 (0)
Please sign in to comment.