From 8528e0beff83ea39c678005879ffef77294d8451 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Borcz?= Date: Fri, 10 Sep 2021 11:49:22 +0200 Subject: [PATCH] Fix crash in school info when dialer is unavailable (#1500) --- .../main/java/io/github/wulkanowy/utils/ContextExtension.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/io/github/wulkanowy/utils/ContextExtension.kt b/app/src/main/java/io/github/wulkanowy/utils/ContextExtension.kt index 68d3afe8..2cd4459e 100644 --- a/app/src/main/java/io/github/wulkanowy/utils/ContextExtension.kt +++ b/app/src/main/java/io/github/wulkanowy/utils/ContextExtension.kt @@ -102,7 +102,9 @@ fun Context.openNavigation(location: String) { fun Context.openDialer(phone: String) { val intentUri = Uri.parse("tel:$phone") val intent = Intent(Intent.ACTION_DIAL, intentUri) - startActivity(intent) + if (intent.resolveActivity(packageManager) != null) { + startActivity(intent) + } } fun Context.shareText(text: String, subject: String?) {