From 2b265e3bd54b0e71e0560be6eea3f6450b794e37 Mon Sep 17 00:00:00 2001 From: cyBerta Date: Sat, 9 May 2020 01:24:57 +0200 Subject: catch ActivityNotFoundException for the rare case when Android can't find any Activity which is able to open a intent containing a URL --- .../se/leap/bitmaskclient/fragments/DonationReminderDialog.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'app/src/main') diff --git a/app/src/main/java/se/leap/bitmaskclient/fragments/DonationReminderDialog.java b/app/src/main/java/se/leap/bitmaskclient/fragments/DonationReminderDialog.java index d2454d77..046acad4 100644 --- a/app/src/main/java/se/leap/bitmaskclient/fragments/DonationReminderDialog.java +++ b/app/src/main/java/se/leap/bitmaskclient/fragments/DonationReminderDialog.java @@ -1,6 +1,7 @@ package se.leap.bitmaskclient.fragments; import android.app.Dialog; +import android.content.ActivityNotFoundException; import android.content.Context; import android.content.Intent; import android.net.Uri; @@ -57,7 +58,11 @@ public class DonationReminderDialog extends AppCompatDialogFragment { builder.setView(view); btnDonate.setOnClickListener(v -> { Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(DONATION_URL)); - startActivity(browserIntent); + try { + startActivity(browserIntent); + } catch (ActivityNotFoundException e) { + e.printStackTrace(); + } PreferenceHelper.putString(getContext(), LAST_DONATION_REMINDER_DATE, DateHelper.getCurrentDateString()); dismiss(); -- cgit v1.2.3