From 9e6e3b40574afffa4d08a47bbd695a0322b39ea3 Mon Sep 17 00:00:00 2001 From: rsb-23 <57601627+rsb-23@users.noreply.github.com> Date: Mon, 4 Jul 2022 00:17:08 +0530 Subject: [PATCH] =?UTF-8?q?Fixed=20issue=20#261=20of=200=E2=88=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cause : lastKey was not updated when newValue became "". Hence lastKey validation at line 95 failed. --- .../com/simplemobiletools/calculator/helpers/CalculatorImpl.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 d04cdbd3..5ff4804e 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calculator/helpers/CalculatorImpl.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calculator/helpers/CalculatorImpl.kt @@ -324,8 +324,9 @@ class CalculatorImpl( val lastDeletedValue = inputDisplayedFormula.lastOrNull().toString() var newValue = inputDisplayedFormula.dropLast(1) - if (newValue == "") { + if (newValue == "" || newValue == "0") { newValue = "0" + lastKey = CLEAR } else { if (operations.contains(lastDeletedValue) || lastKey == EQUALS) { lastOperation = ""