Merge pull request #231 from Aga-C/fix-sign-change

Fixed changing operator after dividing by zero (#202)
This commit is contained in:
Tibor Kaputa 2021-12-29 21:52:47 +01:00 committed by GitHub
commit 5293466274
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 2 deletions

View File

@ -118,8 +118,14 @@ class CalculatorImpl(calculator: Calculator, private val context: Context) {
}
}
lastKey = operation
lastOperation = operation
if (getSecondValue() == 0.0 && inputDisplayedFormula.contains("÷")) {
lastKey = DIVIDE
lastOperation = DIVIDE
} else {
lastKey = operation
lastOperation = operation
}
showNewResult(inputDisplayedFormula)
}