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)