openUri: avoid crash on unexpected exception

This commit is contained in:
Pierre-Yves Nicolas
2026-06-13 07:46:59 +02:00
parent 2ab5dcf7d9
commit 974ee5f913
@@ -460,13 +460,13 @@ class MainActivity : ComponentActivity() {
}
try {
startActivity(chooser)
} catch (e: SecurityException) {
} catch (_: ActivityNotFoundException) {
showToast(getString(R.string.error_no_app))
} catch (e: Exception) {
val errorMessage =
"Failed to open URI, scheme=${uriToOpen.scheme}, authority=${uriToOpen.authority}"
logger.e("OpenUri", errorMessage, e)
showToast(getString(R.string.error_occurred))
} catch (_: ActivityNotFoundException) {
showToast(getString(R.string.error_no_app))
}
}