Skip to content
Permalink
Browse files
Handle division by zero
  • Loading branch information
wonder-sk committed Aug 9, 2011
1 parent 4d0e59c commit 047ae039a92aa8241e01d6e81d9dee6a56493423
Showing with 2 additions and 0 deletions.
  1. +2 −0 src/core/qgsexpression.cpp
@@ -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

0 comments on commit 047ae03

Please sign in to comment.