From f9f8c4a9efc6c9486ca37079575d44a7284b7d5c Mon Sep 17 00:00:00 2001 From: FineFindus Date: Thu, 13 Jun 2024 21:25:14 +0200 Subject: [PATCH] fix(ErrorStatusDisplayItem): disable open in browser button on null URL Disables the Open in Browser, if the URL is null, as otherwise the app would crash when trying to open the null URL. --- .../android/ui/displayitems/ErrorStatusDisplayItem.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mastodon/src/main/java/org/joinmastodon/android/ui/displayitems/ErrorStatusDisplayItem.java b/mastodon/src/main/java/org/joinmastodon/android/ui/displayitems/ErrorStatusDisplayItem.java index 33ca9f4c21..2000ee0c2f 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/ui/displayitems/ErrorStatusDisplayItem.java +++ b/mastodon/src/main/java/org/joinmastodon/android/ui/displayitems/ErrorStatusDisplayItem.java @@ -4,6 +4,7 @@ import android.os.Build; import android.view.View; import android.view.ViewGroup; +import android.widget.Button; import org.joinmastodon.android.BuildConfig; import org.joinmastodon.android.R; @@ -32,7 +33,9 @@ public static class Holder extends StatusDisplayItem.Holder UiUtils.launchWebBrowser(v.getContext(), item.status.url)); + Button openInBrowserButton=findViewById(R.id.button_open_browser); + openInBrowserButton.setEnabled(item.status.url!=null); + openInBrowserButton.setOnClickListener(v -> UiUtils.launchWebBrowser(v.getContext(), item.status.url)); findViewById(R.id.button_copy_error_details).setOnClickListener(this::copyErrorDetails); }