Skip to content

Commit de54a88

Browse files
committed
catching some exceptions
1 parent 3b1ee82 commit de54a88

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/ThreadActivity.kt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,8 +188,11 @@ class ThreadActivity : SimpleActivity() {
188188
it.phoneNumbers.contains(it.name)
189189
}
190190

191-
if (participants.isNotEmpty() && messages.hashCode() == cachedMessagesCode && !hasParticipantWithoutName) {
192-
return@ensureBackgroundThread
191+
try {
192+
if (participants.isNotEmpty() && messages.hashCode() == cachedMessagesCode && !hasParticipantWithoutName) {
193+
return@ensureBackgroundThread
194+
}
195+
} catch (ignored: Exception) {
193196
}
194197

195198
setupParticipants()

app/src/main/kotlin/com/simplemobiletools/smsmessenger/receivers/SmsReceiver.kt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,12 @@ class SmsReceiver : BroadcastReceiver() {
4040
val newMessageId = context.insertNewSMS(address, subject, body, date, read, threadId, type, subscriptionId)
4141

4242
val conversation = context.getConversations(threadId).firstOrNull() ?: return@ensureBackgroundThread
43-
context.conversationsDB.insertOrUpdate(conversation)
44-
context.updateUnreadCountBadge(context.conversationsDB.getUnreadConversations())
43+
try {
44+
context.conversationsDB.insertOrUpdate(conversation)
45+
} catch (ignored: Exception) {
46+
}
4547

48+
context.updateUnreadCountBadge(context.conversationsDB.getUnreadConversations())
4649
val participant = SimpleContact(0, 0, address, "", arrayListOf(address), ArrayList(), ArrayList())
4750
val participants = arrayListOf(participant)
4851
val messageDate = (date / 1000).toInt()

0 commit comments

Comments
 (0)