catch exceptions thrown at fetching new thread IDs

This commit is contained in:
tibbi 2020-06-17 20:28:39 +02:00
parent 9641eed138
commit 05c84e498c
1 changed files with 10 additions and 2 deletions

View File

@ -500,7 +500,11 @@ fun Context.markMessageRead(id: Int, isMMS: Boolean) {
@SuppressLint("NewApi") @SuppressLint("NewApi")
fun Context.getThreadId(address: String): Long { fun Context.getThreadId(address: String): Long {
return if (isMarshmallowPlus()) { return if (isMarshmallowPlus()) {
Threads.getOrCreateThreadId(this, address) try {
Threads.getOrCreateThreadId(this, address)
} catch (e: Exception) {
0
}
} else { } else {
0 0
} }
@ -509,7 +513,11 @@ fun Context.getThreadId(address: String): Long {
@SuppressLint("NewApi") @SuppressLint("NewApi")
fun Context.getThreadId(addresses: Set<String>): Long { fun Context.getThreadId(addresses: Set<String>): Long {
return if (isMarshmallowPlus()) { return if (isMarshmallowPlus()) {
Threads.getOrCreateThreadId(this, addresses) try {
Threads.getOrCreateThreadId(this, addresses)
} catch (e: Exception) {
0
}
} else { } else {
0 0
} }