Skip to content

Commit

Permalink
refactor: handle ActivityNotFoundException when opening URIs
Browse files Browse the repository at this point in the history
  • Loading branch information
andrekir committed Apr 1, 2024
1 parent 6e3e173 commit 9024d36
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.geeksville.mesh.ui

import android.content.ActivityNotFoundException
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.text.ClickableText
import androidx.compose.material.MaterialTheme
Expand Down Expand Up @@ -55,7 +56,11 @@ fun LinkedCoordinates(
debug("Clicked on link")
annotatedString.getStringAnnotations(tag = "gps", start = offset, end = offset)
.firstOrNull()?.let {
uriHandler.openUri(it.item)
try {
uriHandler.openUri(it.item)
} catch (ex: ActivityNotFoundException) {
debug("No application found: $ex")
}
}
}
)
Expand Down

0 comments on commit 9024d36

Please sign in to comment.