mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2025-09-30 21:42:54 +02:00
Fixing crash when the last :
is not present in an address
This commit is contained in:
@@ -66,8 +66,8 @@ data class Address(
|
||||
fun parse(addressId: String): Address? =
|
||||
try {
|
||||
val parts = addressId.split(":", limit = 3)
|
||||
if (parts.size > 1 && parts[1].length == 64 && Hex.isHex(parts[1])) {
|
||||
Address(parts[0].toInt(), parts[1], parts[2])
|
||||
if (parts.size > 2 && parts[1].length == 64 && Hex.isHex(parts[1])) {
|
||||
Address(parts[0].toInt(), parts[1], parts.getOrNull(2) ?: "")
|
||||
} else {
|
||||
if (addressId.startsWith("naddr1")) {
|
||||
val addr = Nip19Parser.uriToRoute(addressId)?.entity
|
||||
|
Reference in New Issue
Block a user