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