diff --git a/app/src/main/java/net/pokeranalytics/android/ui/modules/handhistory/HandHistoryFragment.kt b/app/src/main/java/net/pokeranalytics/android/ui/modules/handhistory/HandHistoryFragment.kt index 9d996a33..80d3eb96 100644 --- a/app/src/main/java/net/pokeranalytics/android/ui/modules/handhistory/HandHistoryFragment.kt +++ b/app/src/main/java/net/pokeranalytics/android/ui/modules/handhistory/HandHistoryFragment.kt @@ -354,6 +354,10 @@ class HandHistoryFragment : RealmFragment(), RowRepresentableDelegate, KeyboardL override fun onRowValueChanged(value: Any?, row: RowRepresentable) { + if (this.model.selectionLiveData.value != null) { + this.model.amountValidated() // validates any edited amount before possibly clearing action + } + when (row) { HandRowType.COMMENT -> { this.model.handHistory.comment = value as? String diff --git a/app/src/main/java/net/pokeranalytics/android/ui/modules/handhistory/model/HandHistoryViewModel.kt b/app/src/main/java/net/pokeranalytics/android/ui/modules/handhistory/model/HandHistoryViewModel.kt index b4ed3e6d..8dcd01f8 100644 --- a/app/src/main/java/net/pokeranalytics/android/ui/modules/handhistory/model/HandHistoryViewModel.kt +++ b/app/src/main/java/net/pokeranalytics/android/ui/modules/handhistory/model/HandHistoryViewModel.kt @@ -503,11 +503,15 @@ class HandHistoryViewModel : ViewModel(), RowRepresentableDataSource, CardCentra */ fun amountValidated() { + if (this.currentAmount?.isEmpty() == true) { + return + } + val amount = try { this.currentAmount?.toDouble() } catch (e: NumberFormatException) { Timber.w("Parsing exception: ${e.message}") - null + return } when (val row = this.rowRepresentables[this.currentSelection.index]) {