Skip to content

Commit

Permalink
Handle exception when checking for Tron active account
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaelekol committed Dec 20, 2024
1 parent 721dc5a commit d435509
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import kotlinx.coroutines.cancel
import kotlinx.coroutines.launch
import kotlinx.coroutines.reactive.asFlow
import java.math.BigDecimal
import java.net.UnknownHostException

class BalanceAdapterRepository(
private val adapterManager: IAdapterManager,
Expand Down Expand Up @@ -115,7 +114,7 @@ class BalanceAdapterRepository(
return BalanceWarning.TronInactiveAccountWarning
}
}
} catch (e: UnknownHostException) {
} catch (e: Exception) {
e.printStackTrace()
}
return null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,15 @@ class ReceiveAddressViewModel(
usedAddresses = adapter.usedAddresses(false)
usedChangeAddresses = adapter.usedAddresses(true)
uri = getUri()
accountActive = adapter.isAddressActive(adapter.receiveAddress)
mainNet = adapter.isMainNet
viewState = ViewState.Success

accountActive = try {
adapter.isAddressActive(adapter.receiveAddress)
} catch (e: Exception) {
viewState = ViewState.Error(e)
false
}
} else {
viewState = ViewState.Error(NullPointerException())
}
Expand Down

0 comments on commit d435509

Please sign in to comment.