From c892bc0492fdcf4137e3f1caa6f9fd6b71f3028d Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 8 Aug 2022 19:21:39 +0200 Subject: [PATCH] adding a null check at blocking calls from not stored contacts --- .../dialer/services/SimpleCallScreeningService.kt | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/dialer/services/SimpleCallScreeningService.kt b/app/src/main/kotlin/com/simplemobiletools/dialer/services/SimpleCallScreeningService.kt index 09eab9f7..b705cfcf 100644 --- a/app/src/main/kotlin/com/simplemobiletools/dialer/services/SimpleCallScreeningService.kt +++ b/app/src/main/kotlin/com/simplemobiletools/dialer/services/SimpleCallScreeningService.kt @@ -14,11 +14,13 @@ class SimpleCallScreeningService : CallScreeningService() { override fun onScreenCall(callDetails: Call.Details) { if (baseConfig.blockUnknownNumbers) { - val simpleContactsHelper = SimpleContactsHelper(this) - val number = Uri.decode(callDetails.handle?.toString()).substringAfter("tel:") - val privateCursor = getMyContactsCursor(false, true) - simpleContactsHelper.exists(number, privateCursor) { exists -> - respondToCall(callDetails, !exists) + if (callDetails.handle != null) { + val simpleContactsHelper = SimpleContactsHelper(this) + val number = Uri.decode(callDetails.handle?.toString() ?: "").substringAfter("tel:") + val privateCursor = getMyContactsCursor(false, true) + simpleContactsHelper.exists(number, privateCursor) { exists -> + respondToCall(callDetails, !exists) + } } } else { respondToCall(callDetails, false)