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.
This commit is contained in:
Matthias Kuhn 2017-12-27 19:48:20 +01:00
parent e552b9b2de
commit aa3bfff7a8

View File

@ -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