adding a null check at blocking calls from not stored contacts

This commit is contained in:
tibbi 2022-08-08 19:21:39 +02:00
parent d4f9fc28b7
commit c892bc0492
1 changed files with 7 additions and 5 deletions

View File

@ -14,12 +14,14 @@ class SimpleCallScreeningService : CallScreeningService() {
override fun onScreenCall(callDetails: Call.Details) {
if (baseConfig.blockUnknownNumbers) {
if (callDetails.handle != null) {
val simpleContactsHelper = SimpleContactsHelper(this)
val number = Uri.decode(callDetails.handle?.toString()).substringAfter("tel:")
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)
}