Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Handle division by zero
  • Loading branch information
wonder-sk committed Aug 9, 2011
1 parent 4d0e59c commit 047ae03
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/core/qgsexpression.cpp
Expand Up @@ -583,6 +583,8 @@ QVariant QgsExpression::NodeBinaryOperator::eval( QgsExpression* parent, QgsFeat
return QVariant();
else if ( isNumeric( vL ) && isNumeric( vR ) )
{
if ( mOp == boDiv && qvDouble( vR ) == 0 )
return QVariant(); // silently handle division by zero and return NULL
if ( isInt( vL ) && isInt( vR ) )
return QVariant( computeInt( qvInt( vL ), qvInt( vR ) ) );
else
Expand Down

0 comments on commit 047ae03

Please sign in to comment.