Prevent crash when clicking on URI in chat if not matching app is found
This commit is contained in:
parent
1767ae559b
commit
a629c3264d
1 changed files with 5 additions and 2 deletions
|
@ -505,14 +505,17 @@ class DetailChatRoomFragment : MasterFragment<ChatRoomDetailFragmentBinding, Cha
|
||||||
viewLifecycleOwner
|
viewLifecycleOwner
|
||||||
) {
|
) {
|
||||||
it.consume { url ->
|
it.consume { url ->
|
||||||
|
val uri = Uri.parse(url)
|
||||||
val browserIntent = Intent(
|
val browserIntent = Intent(
|
||||||
Intent.ACTION_VIEW,
|
Intent.ACTION_VIEW,
|
||||||
Uri.parse(url)
|
uri
|
||||||
)
|
)
|
||||||
try {
|
try {
|
||||||
startActivity(browserIntent)
|
startActivity(browserIntent)
|
||||||
} catch (se: SecurityException) {
|
} catch (se: SecurityException) {
|
||||||
Log.e("[Chat Room] Failed to start browser intent, $se")
|
Log.e("[Chat Room] Failed to start browser intent from uri [$uri]: $se")
|
||||||
|
} catch (anfe: ActivityNotFoundException) {
|
||||||
|
Log.e("[Chat Room] Failed to find app matching intent from uri [$uri]: $anfe")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue