Add of a simple check in order to fix the division-by-zero bug
This commit is contained in:
parent
d09aa44f91
commit
2f46e77ba3
|
@ -147,6 +147,10 @@ class CalculatorImpl(calculator: Calculator, private val context: Context) {
|
||||||
|
|
||||||
secondValue = getSecondValue()
|
secondValue = getSecondValue()
|
||||||
calculateResult()
|
calculateResult()
|
||||||
|
if (lastOperation == DIVIDE && secondValue == 0.0){
|
||||||
|
lastKey = DIGIT
|
||||||
|
return
|
||||||
|
}
|
||||||
lastKey = EQUALS
|
lastKey = EQUALS
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue