From e08505491f3ceef8a913611bb73e70b512939a77 Mon Sep 17 00:00:00 2001 From: Bnyro <82752168+Bnyro@users.noreply.github.com> Date: Fri, 10 Mar 2023 18:00:42 +0100 Subject: [PATCH] Fix crash when clicking links in about without browser available (#3284) * Fix crash when clicking links in about without browser available --- .../java/com/github/libretube/helpers/IntentHelper.kt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/github/libretube/helpers/IntentHelper.kt b/app/src/main/java/com/github/libretube/helpers/IntentHelper.kt index 0c3c3f0959..bc0836bb19 100644 --- a/app/src/main/java/com/github/libretube/helpers/IntentHelper.kt +++ b/app/src/main/java/com/github/libretube/helpers/IntentHelper.kt @@ -3,11 +3,17 @@ package com.github.libretube.helpers import android.content.Context import android.content.Intent import android.net.Uri +import com.github.libretube.R +import com.github.libretube.extensions.toastFromMainThread object IntentHelper { fun openLinkFromHref(context: Context, link: String) { val uri = Uri.parse(link) val launchIntent = Intent(Intent.ACTION_VIEW).setData(uri) - context.startActivity(launchIntent) + try { + context.startActivity(launchIntent) + } catch (e: Exception) { + context.toastFromMainThread(R.string.unknown_error) + } } }