From 15dc9c3dc71ebd1538f82c78b6faf441f53ea725 Mon Sep 17 00:00:00 2001 From: Harsh Shandilya Date: Tue, 18 Oct 2022 12:08:49 +0530 Subject: [PATCH] fix(common): prevent link metadata resolution from creating fatal errors --- .../kotlin/dev/msfjarvis/claw/common/comments/CommentEntry.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/common/src/main/kotlin/dev/msfjarvis/claw/common/comments/CommentEntry.kt b/common/src/main/kotlin/dev/msfjarvis/claw/common/comments/CommentEntry.kt index 5eeabeec..41904740 100644 --- a/common/src/main/kotlin/dev/msfjarvis/claw/common/comments/CommentEntry.kt +++ b/common/src/main/kotlin/dev/msfjarvis/claw/common/comments/CommentEntry.kt @@ -58,7 +58,8 @@ fun CommentsHeader( produceState( initialValue = LinkMetadata(postDetails.url, null, null), ) { - value = postActions.getLinkMetadata(postDetails.url) + runCatching { postActions.getLinkMetadata(postDetails.url) } + .onSuccess { metadata -> value = metadata } } Surface(color = MaterialTheme.colorScheme.background, modifier = modifier) {