diff options
author | bajb <brooke@bajb.net> | 2016-04-01 16:29:41 +0300 |
---|---|---|
committer | bajb <brooke@bajb.net> | 2016-04-01 16:29:41 +0300 |
commit | 5d19d0660c395cf500c01c9f3f1e451f6914080b (patch) | |
tree | 721ba219cc7ec1933a56e8761e196575e63ba5bb /src | |
parent | e28fb4d7aae033734d3ab3d3ca43ff9901f9638c (diff) |
Avoid division by zero
Diffstat (limited to 'src')
-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..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); } |