aboutsummaryrefslogtreecommitdiff
path: root/src/NXP/Classes
diff options
context:
space:
mode:
authorbajb <brooke@bajb.net>2016-04-01 16:29:41 +0300
committerbajb <brooke@bajb.net>2016-04-01 16:29:41 +0300
commit5d19d0660c395cf500c01c9f3f1e451f6914080b (patch)
tree721ba219cc7ec1933a56e8761e196575e63ba5bb /src/NXP/Classes
parente28fb4d7aae033734d3ab3d3ca43ff9901f9638c (diff)
Avoid division by zero
Diffstat (limited to 'src/NXP/Classes')
-rw-r--r--src/NXP/Classes/Token/TokenDivision.php2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/NXP/Classes/Token/TokenDivision.php b/src/NXP/Classes/Token/TokenDivision.php
index 479a4ec..7e55640 100644
--- a/src/NXP/Classes/Token/TokenDivision.php
+++ b/src/NXP/Classes/Token/TokenDivision.php
@@ -47,7 +47,7 @@ class TokenDivision extends AbstractOperator
{
$op2 = array_pop($stack);
$op1 = array_pop($stack);
- $result = $op1->getValue() / $op2->getValue();
+ $result = $op2->getValue() > 0 ? $op1->getValue() / $op2->getValue() : 0;
return new TokenNumber($result);
}