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.
This commit is contained in:
parent
6ad8a85044
commit
f9f8c4a9ef
1 changed files with 4 additions and 1 deletions
|
@ -4,6 +4,7 @@ import android.content.Context;
|
|||
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 class ErrorStatusDisplayItem extends StatusDisplayItem{
|
|||
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue