From a7f2a976173208694e3b2031b7116d1a9a486c2d Mon Sep 17 00:00:00 2001 From: Tangem Date: Mon, 15 Jan 2024 19:27:16 +0300 Subject: [PATCH] Updated on 2026-08-14 --- .../tangem/feature/swap/viewmodels/SwapViewModel.kt | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/features/swap/presentation/src/main/java/com/tangem/feature/swap/viewmodels/SwapViewModel.kt b/features/swap/presentation/src/main/java/com/tangem/feature/swap/viewmodels/SwapViewModel.kt index 16da56f847..46e3203d95 100644 --- a/features/swap/presentation/src/main/java/com/tangem/feature/swap/viewmodels/SwapViewModel.kt +++ b/features/swap/presentation/src/main/java/com/tangem/feature/swap/viewmodels/SwapViewModel.kt @@ -109,11 +109,14 @@ internal class SwapViewModel @Inject constructor( init { viewModelScope.launch(dispatchers.io) { swapInteractor.getSelectedWallet()?.let { - initialCryptoCurrencyStatus = - requireNotNull(getCryptoCurrencyStatusUseCase(it.walletId, initialCryptoCurrency.id).getOrNull()) { - "Failed to get initial crypto currency status" - } - initTokens() + val cryptoCurrencyStatus = + getCryptoCurrencyStatusUseCase(it.walletId, initialCryptoCurrency.id).getOrNull() + if (cryptoCurrencyStatus == null) { + uiState = stateBuilder.addAlert(uiState, swapRouter::back) + } else { + initialCryptoCurrencyStatus = cryptoCurrencyStatus + initTokens() + } } } }