From 8b53d28721531ea489c603c25170913ae8877cbd Mon Sep 17 00:00:00 2001 From: Vitor Pamplona Date: Tue, 14 Mar 2023 19:08:06 -0400 Subject: [PATCH] Doesn't crash when a non-hex key is inserted in the contact list --- .../amethyst/service/model/ContactListEvent.kt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/vitorpamplona/amethyst/service/model/ContactListEvent.kt b/app/src/main/java/com/vitorpamplona/amethyst/service/model/ContactListEvent.kt index 5c301b18e..433b5b4a2 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/service/model/ContactListEvent.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/service/model/ContactListEvent.kt @@ -23,7 +23,12 @@ class ContactListEvent( val verifiedFollowKeySet: Set by lazy { tags.filter { it[0] == "p" }.mapNotNull { it.getOrNull(1)?.let { unverifiedHex: String -> - decodePublicKey(unverifiedHex).toHexKey() + try { + decodePublicKey(unverifiedHex).toHexKey() + } catch (e: Exception) { + Log.w("ContactListEvent", "Can't parse tags as a follows: ${it[1]}", e) + null + } } }.toSet() }