diff --git a/app/src/main/java/io/heckel/ntfy/ui/DetailAdapter.kt b/app/src/main/java/io/heckel/ntfy/ui/DetailAdapter.kt index b60ed78..bc5f5c3 100644 --- a/app/src/main/java/io/heckel/ntfy/ui/DetailAdapter.kt +++ b/app/src/main/java/io/heckel/ntfy/ui/DetailAdapter.kt @@ -433,11 +433,15 @@ class DetailAdapter(private val activity: Activity, private val lifecycleScope: } private fun runViewAction(context: Context, action: Action) { - val url = action.url ?: return - val intent = Intent(Intent.ACTION_VIEW, Uri.parse(url)).apply { - addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION) + try { + val url = action.url ?: return + val intent = Intent(Intent.ACTION_VIEW, Uri.parse(url)).apply { + addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION) + } + context.startActivity(intent) + } catch (e: Exception) { + Log.w(TAG, "Unable to start activity from URL ${action.url}", e) } - context.startActivity(intent) } private fun runOtherUserAction(context: Context, notification: Notification, action: Action) { diff --git a/fastlane/metadata/android/en-US/changelog/27.txt b/fastlane/metadata/android/en-US/changelog/27.txt index 9719556..2a3c944 100644 --- a/fastlane/metadata/android/en-US/changelog/27.txt +++ b/fastlane/metadata/android/en-US/changelog/27.txt @@ -7,6 +7,7 @@ Bugs: * Restoring topics or settings from backup doesn't work (#223, thanks to @shadow00 for reporting) * Fix app icon on old Android versions (#120, thanks to @shadow00 for reporting) * Fix races in UnifiedPush registration (#230, thanks to @Jakob for reporting) +* Prevent view action from crashing the app (#233) **Thanks for testing:**