From 4f796669f62c4882ec907efa4d495fc04a44d9bd Mon Sep 17 00:00:00 2001 From: Ricki Hirner Date: Mon, 14 Nov 2016 18:38:15 +0100 Subject: [PATCH] Avoid some crashes * check whether ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATION can be resolved before launching it * cert4android: don't crash when service can't be bound --- .../java/at/bitfire/davdroid/ui/StartupDialogFragment.java | 3 ++- cert4android | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/at/bitfire/davdroid/ui/StartupDialogFragment.java b/app/src/main/java/at/bitfire/davdroid/ui/StartupDialogFragment.java index 814026dc..d0db8c3e 100644 --- a/app/src/main/java/at/bitfire/davdroid/ui/StartupDialogFragment.java +++ b/app/src/main/java/at/bitfire/davdroid/ui/StartupDialogFragment.java @@ -112,7 +112,8 @@ public class StartupDialogFragment extends DialogFragment { public void onClick(DialogInterface dialog, int which) { Intent intent = new Intent(android.provider.Settings.ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS, Uri.parse("package:" + BuildConfig.APPLICATION_ID)); - getContext().startActivity(intent); + if (intent.resolveActivity(getContext().getPackageManager()) != null) + getContext().startActivity(intent); } }) .setNegativeButton(R.string.startup_dont_show_again, new DialogInterface.OnClickListener() { diff --git a/cert4android b/cert4android index 30b8bc58..3c55eb1f 160000 --- a/cert4android +++ b/cert4android @@ -1 +1 @@ -Subproject commit 30b8bc58ce3dccc8c41af0b4d224a3b5aafd5979 +Subproject commit 3c55eb1f6e066cd0e7b854388e46a7bb93374781