aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNeonXP <frei@neonxp.info>2016-04-01 17:06:45 +0300
committerNeonXP <frei@neonxp.info>2016-04-01 17:06:45 +0300
commitfd7a113b956983e31abc1ce170fa7c6f2944f86d (patch)
treec60152b65e278d4caa4750d4763567021d35a612
parente28fb4d7aae033734d3ab3d3ca43ff9901f9638c (diff)
parent9acdc3bb5736f876c69dec51380580a4aadef201 (diff)
Merge pull request #13 from bajb/master
Avoid division by zero
-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..f1c35ff 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);
}