From bf37209a15d8f981fb9c273ab119e0fcdded9b38 Mon Sep 17 00:00:00 2001 From: aminecmi Date: Sun, 26 Feb 2023 15:40:58 +0100 Subject: [PATCH] debug: activity not found exception. --- .../android/fragments/ArticleFragment.kt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/androidApp/src/main/java/bou/amine/apps/readerforselfossv2/android/fragments/ArticleFragment.kt b/androidApp/src/main/java/bou/amine/apps/readerforselfossv2/android/fragments/ArticleFragment.kt index 67c69c3..f3f37a7 100644 --- a/androidApp/src/main/java/bou/amine/apps/readerforselfossv2/android/fragments/ArticleFragment.kt +++ b/androidApp/src/main/java/bou/amine/apps/readerforselfossv2/android/fragments/ArticleFragment.kt @@ -1,5 +1,6 @@ package bou.amine.apps.readerforselfossv2.android.fragments +import android.content.ActivityNotFoundException import android.content.Intent import android.content.res.ColorStateList import android.content.res.TypedArray @@ -305,7 +306,11 @@ class ArticleFragment : Fragment(), DIAware { @Deprecated("Deprecated in Java") override fun shouldOverrideUrlLoading(view: WebView?, url: String): Boolean { if (binding.webcontent.hitTestResult.type != WebView.HitTestResult.SRC_IMAGE_ANCHOR_TYPE) { - requireContext().startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(url))) + try { + requireContext().startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(url))) + } catch (e: ActivityNotFoundException) { + e.sendSilentlyWithAcraWithName("activityNotFound > $url") + } } return true }