adding a list empty check
This commit is contained in:
parent
2b8fe04820
commit
def1240f0f
1 changed files with 4 additions and 0 deletions
|
@ -168,6 +168,10 @@ class CalculatorImpl(calculator: Calculator, private val context: Context) {
|
|||
if (lastKey != EQUALS) {
|
||||
val valueToCheck = inputDisplayedFormula.trimStart('-').replace(",", "")
|
||||
val parts = valueToCheck.split(operationsRegex).filter { it != "" }
|
||||
if (parts.isEmpty()) {
|
||||
return
|
||||
}
|
||||
|
||||
baseValue = Formatter.stringToDouble(parts.first())
|
||||
if (inputDisplayedFormula.startsWith("-")) {
|
||||
baseValue *= -1
|
||||
|
|
Loading…
Reference in a new issue