Fixes crash when rate is null

feature/top10
Laurent 7 years ago
parent a951a91865
commit 50feb6dc80
  1. 9
      app/src/main/java/net/pokeranalytics/android/ui/fragment/BankrollDataFragment.kt

@ -117,12 +117,9 @@ class BankrollDataFragment : EditableDataFragment(), StaticRowRepresentableDataS
return when (row) {
SimpleRow.NAME -> row.editingDescriptors(mapOf("defaultValue" to this.bankroll.name))
BankrollRow.RATE -> {
this.bankroll.currency?.rate?.let { rate ->
row.editingDescriptors(mapOf("defaultValue" to CurrencyUtils.getCurrencyRateFormatter().format(rate)))
} ?: run {
row.editingDescriptors(mapOf())
}
val rate = this.bankroll.currency?.rate ?: 1.0
val rateFormatted = CurrencyUtils.getCurrencyRateFormatter().format(rate)
row.editingDescriptors(mapOf("defaultValue" to rateFormatted))
}
else -> null
}

Loading…
Cancel
Save