Avoid a crash in SendTransactionFragment when there are no assets loaded into de db.

This commit is contained in:
Severiano Jaramillo 2018-12-17 16:51:24 -06:00
parent f8c9594602
commit 5c20e2470d
2 changed files with 2 additions and 11 deletions

View file

@ -38,7 +38,6 @@ import cy.agorise.graphenej.api.calls.BroadcastTransaction
import cy.agorise.graphenej.api.calls.GetAccountByName
import cy.agorise.graphenej.api.calls.GetDynamicGlobalProperties
import cy.agorise.graphenej.api.calls.GetRequiredFees
import cy.agorise.graphenej.crypto.SecureRandomGenerator
import cy.agorise.graphenej.models.AccountProperties
import cy.agorise.graphenej.models.DynamicGlobalProperties
import cy.agorise.graphenej.models.JsonRpcResponse
@ -374,7 +373,8 @@ class SendTransactionFragment : Fragment(), ZXingScannerView.ResultHandler, Serv
}
private fun validateAmount(amount: Double) {
val balance = mBalancesDetailsAdapter!!.getItem(spAsset.selectedItemPosition)!!
if (mBalancesDetailsAdapter?.isEmpty != false) return
val balance = mBalancesDetailsAdapter?.getItem(spAsset.selectedItemPosition) ?: return
val currentAmount = balance.amount.toDouble() / Math.pow(10.0, balance.precision.toDouble())
if (currentAmount < amount) {

View file

@ -1,8 +1,5 @@
package cy.agorise.bitsybitshareswallet.utils
import cy.agorise.graphenej.Asset
object Constants {
/** Key used to store the number of the last agreed License version */
@ -11,12 +8,6 @@ object Constants {
/** Version of the currently used license */
const val CURRENT_LICENSE_VERSION = 1
/**
* Key used to store a preference value used to keep track of the last time the assets in
* database were updated.
*/
const val KEY_LAST_ASSET_LIST_UPDATE = "key_last_assets_update"
/** Key used to store if the initial setup is already done or not */
const val KEY_INITIAL_SETUP_DONE = "key_initial_setup_done"