mirror of
https://github.com/SimpleMobileTools/Simple-Calculator.git
synced 2025-04-14 10:12:07 +02:00
adding a list empty check
This commit is contained in:
parent
2b8fe04820
commit
def1240f0f
@ -168,6 +168,10 @@ class CalculatorImpl(calculator: Calculator, private val context: Context) {
|
|||||||
if (lastKey != EQUALS) {
|
if (lastKey != EQUALS) {
|
||||||
val valueToCheck = inputDisplayedFormula.trimStart('-').replace(",", "")
|
val valueToCheck = inputDisplayedFormula.trimStart('-').replace(",", "")
|
||||||
val parts = valueToCheck.split(operationsRegex).filter { it != "" }
|
val parts = valueToCheck.split(operationsRegex).filter { it != "" }
|
||||||
|
if (parts.isEmpty()) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
baseValue = Formatter.stringToDouble(parts.first())
|
baseValue = Formatter.stringToDouble(parts.first())
|
||||||
if (inputDisplayedFormula.startsWith("-")) {
|
if (inputDisplayedFormula.startsWith("-")) {
|
||||||
baseValue *= -1
|
baseValue *= -1
|
||||||
|
Loading…
x
Reference in New Issue
Block a user