Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Expressions: test prepare() and fix segfault
  • Loading branch information
m-kuhn committed Dec 25, 2015
1 parent 5f1959b commit d746a94
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/core/qgsexpression.cpp
Expand Up @@ -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 );
}


Expand Down
4 changes: 4 additions & 0 deletions tests/src/core/testqgsexpression.cpp
Expand Up @@ -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() )
{
Expand Down

0 comments on commit d746a94

Please sign in to comment.