From f92d80099ba75ba8f1f8b76677ca846997c5bc4e Mon Sep 17 00:00:00 2001 From: Agnieszka C <85929121+Aga-C@users.noreply.github.com> Date: Sun, 5 Dec 2021 10:39:04 +0100 Subject: [PATCH] Fixed changing operator after dividing by zero (#202) --- .../calculator/helpers/CalculatorImpl.kt | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/calculator/helpers/CalculatorImpl.kt b/app/src/main/kotlin/com/simplemobiletools/calculator/helpers/CalculatorImpl.kt index 9b9f0476..65ba64fe 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calculator/helpers/CalculatorImpl.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calculator/helpers/CalculatorImpl.kt @@ -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) }