Skip to content
Permalink
Browse files

Expressions: test prepare() and fix segfault

  • Loading branch information
m-kuhn committed Dec 25, 2015
1 parent 5f1959b commit d746a942737b8680d66c50d7f9ec6d3d93836e89
Showing with 5 additions and 1 deletion.
  1. +1 −1 src/core/qgsexpression.cpp
  2. +4 −0 tests/src/core/testqgsexpression.cpp
@@ -4189,7 +4189,7 @@ QgsExpression::Node* QgsExpression::NodeCondition::clone() const
WhenThenList conditions;
Q_FOREACH ( WhenThen* wt, mConditions )
conditions.append( new WhenThen( wt->mWhenExp->clone(), wt->mThenExp->clone() ) );
return new NodeCondition( conditions, mElseExp->clone() );
return new NodeCondition( conditions, mElseExp ? mElseExp->clone() : nullptr );
}


@@ -770,6 +770,10 @@ class TestQgsExpression: public QObject
//qDebug() << "type " << res.typeName();
QCOMPARE( exp.hasEvalError(), evalError );

QgsExpressionContext context;

Q_ASSERT( exp.prepare( &context ) );

QCOMPARE( result.type(), expected.type() );
switch ( result.type() )
{

0 comments on commit d746a94

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