mirror of
https://github.com/yhirose/cpp-peglib.git
synced 2024-12-22 11:55:30 +00:00
Fixed zero divide problem.
This commit is contained in:
parent
7969d2b75c
commit
db5128a9a5
@ -778,8 +778,13 @@ private:
|
||||
case '+': ret += val; break;
|
||||
case '-': ret -= val; break;
|
||||
case '*': ret *= val; break;
|
||||
case '/': ret /= val; break;
|
||||
case '%': ret %= val; break;
|
||||
case '/':
|
||||
if (val == 0) {
|
||||
throw std::runtime_error("divide by 0 error");
|
||||
}
|
||||
ret /= val;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return Value(ret);
|
||||
|
Loading…
Reference in New Issue
Block a user