catch NaN too, not just infinite

This commit is contained in:
tibbi 2021-02-05 18:13:31 +01:00
parent 7f3358856a
commit 3a03be17f9

View file

@ -175,7 +175,7 @@ class CalculatorImpl(calculator: Calculator, private val context: Context) {
}
val result = ExpressionBuilder(expression.replace(",", "")).build().evaluate()
if (result.isInfinite()) {
if (result.isInfinite() || result.isNaN()) {
context.toast(R.string.unknown_error_occurred)
return
}