Fixed zero divide problem.

This commit is contained in:
yhirose 2015-07-30 17:24:53 -04:00
parent 7969d2b75c
commit db5128a9a5

View File

@ -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);