catch and show an exception

This commit is contained in:
tibbi
2023-02-10 18:38:08 +01:00
parent 9285b8b3d3
commit f91137b770

View File

@ -223,7 +223,12 @@ class CalculatorImpl(
return return
} }
try {
baseValue = parts.first().toDouble() baseValue = parts.first().toDouble()
} catch (e: NumberFormatException) {
context.showErrorToast(e)
}
if (inputDisplayedFormula.startsWith("-")) { if (inputDisplayedFormula.startsWith("-")) {
baseValue *= -1 baseValue *= -1
} }