diff options
author | NeonXP <frei@neonxp.info> | 2016-04-01 17:06:45 +0300 |
---|---|---|
committer | NeonXP <frei@neonxp.info> | 2016-04-01 17:06:45 +0300 |
commit | fd7a113b956983e31abc1ce170fa7c6f2944f86d (patch) | |
tree | c60152b65e278d4caa4750d4763567021d35a612 | |
parent | e28fb4d7aae033734d3ab3d3ca43ff9901f9638c (diff) | |
parent | 9acdc3bb5736f876c69dec51380580a4aadef201 (diff) |
Merge pull request #13 from bajb/master
Avoid division by zero
-rw-r--r-- | src/NXP/Classes/Token/TokenDivision.php | 2 |
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); } |