Skip to content

Commit e292fa6

Browse files
committed
fix: wrap operations with safe()
1 parent 84a1241 commit e292fa6

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

app/src/main/java/to/bitkit/viewmodels/AppViewModel.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -732,7 +732,7 @@ class AppViewModel @Inject constructor(
732732
if (invoice.amountSatoshis > 0uL) {
733733
val maxSendLightning = walletRepo.balanceState.value.maxSendLightningSats
734734
if (maxSendLightning == 0uL || !lightningRepo.canSend(invoice.amountSatoshis)) {
735-
val shortfall = invoice.amountSatoshis - maxSendLightning
735+
val shortfall = invoice.amountSatoshis.safe() - maxSendLightning.safe()
736736
showAddressValidationError(
737737
titleRes = R.string.other__pay_insufficient_spending,
738738
descriptionRes = R.string.other__pay_insufficient_spending_amount_description,
@@ -1122,7 +1122,7 @@ class AppViewModel @Inject constructor(
11221122

11231123
if (!lightningRepo.canSend(invoice.amountSatoshis)) {
11241124
val maxSendLightning = walletRepo.balanceState.value.maxSendLightningSats
1125-
val shortfall = invoice.amountSatoshis - maxSendLightning
1125+
val shortfall = invoice.amountSatoshis.safe() - maxSendLightning.safe()
11261126
toast(
11271127
type = Toast.ToastType.ERROR,
11281128
title = context.getString(R.string.other__pay_insufficient_spending),

0 commit comments

Comments
 (0)