From 423f3e11ffde4815f41182566fb39d0a1e334d77 Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 31 Jan 2022 23:03:23 +0100 Subject: [PATCH] adding a widget crashfix --- app/build.gradle | 2 +- .../com/simplemobiletools/calculator/helpers/CalculatorImpl.kt | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 5f9d9e25..26fafa0a 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -62,7 +62,7 @@ android { } dependencies { - implementation 'com.github.SimpleMobileTools:Simple-Commons:9cb42cbf35' + implementation 'com.github.SimpleMobileTools:Simple-Commons:fe2610738c' implementation 'me.grantland:autofittextview:0.2.1' implementation 'net.objecthunter:exp4j:0.4.8' 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 f65d8335..d33760f4 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calculator/helpers/CalculatorImpl.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calculator/helpers/CalculatorImpl.kt @@ -288,7 +288,8 @@ class CalculatorImpl(calculator: Calculator, private val context: Context) { } fun handleClear() { - val lastDeletedValue = inputDisplayedFormula.last().toString() + val lastDeletedValue = inputDisplayedFormula.lastOrNull().toString() + var newValue = inputDisplayedFormula.dropLast(1) if (newValue == "") { newValue = "0"