Skip to content

Commit

Permalink
BugFix: Unparseable LN invoice
Browse files Browse the repository at this point in the history
  • Loading branch information
vitorpamplona committed Jan 16, 2023
1 parent 4543a68 commit 6605c92
Showing 1 changed file with 16 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,12 @@ import com.vitorpamplona.amethyst.R

@Composable
fun InvoicePreview(lnInvoice: String) {
val amount = LnInvoiceUtil.getAmountInSats(lnInvoice)
val amount = try {
LnInvoiceUtil.getAmountInSats(lnInvoice)
} catch (e: Exception) {
e.printStackTrace()
null
}

val context = LocalContext.current

Expand Down Expand Up @@ -70,14 +75,16 @@ fun InvoicePreview(lnInvoice: String) {

Divider()

Text(
text = "${amount.toInt()} sats",
fontSize = 25.sp,
fontWeight = FontWeight.W500,
modifier = Modifier
.fillMaxWidth()
.padding(vertical = 10.dp),
)
amount?.let {
Text(
text = "${amount.toInt()} sats",
fontSize = 25.sp,
fontWeight = FontWeight.W500,
modifier = Modifier
.fillMaxWidth()
.padding(vertical = 10.dp),
)
}

Button(
modifier = Modifier.fillMaxWidth().padding(vertical = 10.dp),
Expand Down

0 comments on commit 6605c92

Please sign in to comment.