From 2059bdff818a4023857000fedaeb371744dd44f4 Mon Sep 17 00:00:00 2001 From: Christian Schneppe Date: Thu, 6 Feb 2020 19:19:19 +0100 Subject: fix NPE in AboutActivity --- .../java/de/pixart/messenger/ui/AboutActivity.java | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) (limited to 'src/main/java/de') diff --git a/src/main/java/de/pixart/messenger/ui/AboutActivity.java b/src/main/java/de/pixart/messenger/ui/AboutActivity.java index 709ba8ee5..0efaa57c1 100644 --- a/src/main/java/de/pixart/messenger/ui/AboutActivity.java +++ b/src/main/java/de/pixart/messenger/ui/AboutActivity.java @@ -5,11 +5,13 @@ import android.net.Uri; import android.os.Bundle; import android.widget.Button; import android.widget.TextView; +import android.widget.Toast; import java.util.Calendar; import de.pixart.messenger.R; import de.pixart.messenger.utils.ThemeHelper; +import me.drakeet.support.toast.ToastCompat; public class AboutActivity extends XmppActivity { @@ -41,15 +43,23 @@ public class AboutActivity extends XmppActivity { privacyButton = findViewById(R.id.show_privacy_policy); privacyButton.setOnClickListener(view -> { - final Uri uri = Uri.parse("https://jabber.pix-art.de/privacy/"); - Intent browserIntent = new Intent(Intent.ACTION_VIEW, uri); - startActivity(browserIntent); + try { + final Uri uri = Uri.parse("https://jabber.pix-art.de/privacy/"); + Intent browserIntent = new Intent(Intent.ACTION_VIEW, uri); + startActivity(browserIntent); + } catch (Exception e) { + ToastCompat.makeText(this, R.string.no_application_found_to_open_link, Toast.LENGTH_SHORT).show(); + } }); termsOfUseButton = findViewById(R.id.show_terms_of_use); termsOfUseButton.setOnClickListener(view -> { - final Uri uri = Uri.parse("https://jabber.pix-art.de/termsofuse/"); - Intent browserIntent = new Intent(Intent.ACTION_VIEW, uri); - startActivity(browserIntent); + try { + final Uri uri = Uri.parse("https://jabber.pix-art.de/termsofuse/"); + Intent browserIntent = new Intent(Intent.ACTION_VIEW, uri); + startActivity(browserIntent); + } catch (Exception e) { + ToastCompat.makeText(this, R.string.no_application_found_to_open_link, Toast.LENGTH_SHORT).show(); + } }); } } \ No newline at end of file -- cgit v1.2.3