Skip to content

Commit 0eae72a

Browse files
committed
fix: crash related to code not being inside a try catch block
1 parent 903314d commit 0eae72a

File tree

3 files changed

+21
-20
lines changed

3 files changed

+21
-20
lines changed

common/src/commonMain/kotlin/com/blockstream/common/models/onboarding/SetupNewWalletViewModel.kt

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -149,17 +149,17 @@ class SetupNewWalletViewModel(greenWalletOrNull: GreenWallet? = null) :
149149
return
150150
}
151151

152-
val biometricsCipherProvider = viewModelScope.coroutineScope.async(
153-
start = CoroutineStart.LAZY
154-
) {
155-
CompletableDeferred<PlatformCipher>().let {
156-
biometricsPlatformCipher = it
157-
postSideEffect(SideEffects.RequestBiometricsCipher)
158-
it.await()
159-
}
160-
}
161-
162152
doAsync({
153+
val biometricsCipherProvider = viewModelScope.coroutineScope.async(
154+
start = CoroutineStart.LAZY
155+
) {
156+
CompletableDeferred<PlatformCipher>().let {
157+
biometricsPlatformCipher = it
158+
postSideEffect(SideEffects.RequestBiometricsCipher)
159+
it.await()
160+
}
161+
}
162+
163163
onProgressDescription.value = getString(Res.string.id_creating_wallet)
164164

165165
try {

common/src/commonMain/kotlin/com/blockstream/common/models/onboarding/phone/EnterRecoveryPhraseViewModel.kt

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -402,17 +402,17 @@ class EnterRecoveryPhraseViewModel(setupArgs: SetupArgs, stateKeeper: StateKeepe
402402
return
403403
}
404404

405-
val biometricsCipherProvider = viewModelScope.coroutineScope.async(
406-
start = CoroutineStart.LAZY
407-
) {
408-
CompletableDeferred<PlatformCipher>().let {
409-
biometricsPlatformCipher = it
410-
postSideEffect(SideEffects.RequestBiometricsCipher)
411-
it.await()
405+
doAsync({
406+
val biometricsCipherProvider = viewModelScope.coroutineScope.async(
407+
start = CoroutineStart.LAZY
408+
) {
409+
CompletableDeferred<PlatformCipher>().let {
410+
biometricsPlatformCipher = it
411+
postSideEffect(SideEffects.RequestBiometricsCipher)
412+
it.await()
413+
}
412414
}
413-
}
414415

415-
doAsync({
416416
onProgressDescription.value = getString(Res.string.id_recovery_phrase_check)
417417

418418
checkRecoveryPhraseUseCase.invoke(

common/src/commonMain/kotlin/com/blockstream/common/models/send/CreateTransactionViewModel.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import com.blockstream.common.data.SupportData
1515
import com.blockstream.common.extensions.ifConnected
1616
import com.blockstream.common.extensions.isNotBlank
1717
import com.blockstream.common.extensions.launchIn
18+
import com.blockstream.common.extensions.tryCatch
1819
import com.blockstream.common.gdk.FeeBlockHigh
1920
import com.blockstream.common.gdk.FeeBlockLow
2021
import com.blockstream.common.gdk.FeeBlockMedium
@@ -151,7 +152,7 @@ abstract class CreateTransactionViewModelAbstract(
151152
if (it == null) {
152153
_feeEstimation.value = null
153154
} else {
154-
_feeEstimation.value = session.getFeeEstimates(it).fees
155+
_feeEstimation.value = tryCatch { session.getFeeEstimates(it).fees }
155156
_customFeeRate.value = ((_feeEstimation.value?.firstOrNull()
156157
?: it.defaultFee) / 1000.0)
157158
}

0 commit comments

Comments
 (0)