catch exceptions thrown at some operations in general

This commit is contained in:
tibbi 2020-11-05 21:26:41 +01:00
parent b3be3860e8
commit 95211501ab

View File

@ -115,7 +115,11 @@ class CalculatorImpl(calculator: Calculator, val context: Context) {
val operation = OperationFactory.forId(lastOperation!!, baseValue, secondValue)
if (operation != null) {
updateResult(operation.getResult())
try {
updateResult(operation.getResult())
} catch (e: Exception) {
context.toast(R.string.unknown_error_occurred)
}
}
isFirstOperation = false