Skip to content
Permalink
Browse files

Fixed a segfault when a function has no arguments

  • Loading branch information
wonder-sk committed Aug 29, 2011
1 parent 7e68770 commit e32acf53f8cf233fea344ff6c45dfe3fb1d03ab9
Showing with 6 additions and 3 deletions.
  1. +6 −3 src/core/qgsexpression.cpp
@@ -850,9 +850,12 @@ QVariant QgsExpression::NodeFunction::eval( QgsExpression* parent, QgsFeature* f
bool QgsExpression::NodeFunction::prepare( QgsExpression* parent, const QgsFieldMap& fields )
{
bool res = true;
foreach( Node* n, mArgs->list() )
if ( mArgs )
{
res = res && n->prepare( parent, fields );
foreach( Node* n, mArgs->list() )
{
res = res && n->prepare( parent, fields );
}
}
return res;
}
@@ -863,7 +866,7 @@ QString QgsExpression::NodeFunction::dump() const
if ( fd.mParams == 0 )
return fd.mName; // special column
else
return QString( "%1(%2)" ).arg( fd.mName ).arg( mArgs->dump() ); // function
return QString( "%1(%2)" ).arg( fd.mName ).arg( mArgs ? mArgs->dump() : QString() ); // function
}

//

0 comments on commit e32acf5

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