Skip to content

Commit

Permalink
fix(ErrorStatusDisplayItem): disable open in browser button on null URL
Browse files Browse the repository at this point in the history
Disables the Open in Browser, if the URL is null, as otherwise the app
would crash when trying to open the null URL.
  • Loading branch information
FineFindus committed Jun 13, 2024
1 parent 6ad8a85 commit f9f8c4a
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -32,7 +33,9 @@ public static class Holder extends StatusDisplayItem.Holder<ErrorStatusDisplayIt

public Holder(Context context, ViewGroup parent) {
super(context, R.layout.display_item_error, parent);
findViewById(R.id.button_open_browser).setOnClickListener(v -> 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);
}

Expand Down

0 comments on commit f9f8c4a

Please sign in to comment.