adding some crashfixes

This commit is contained in:
tibbi 2020-11-03 19:39:59 +01:00
parent 953d521e47
commit d1fe3531e1
5 changed files with 28 additions and 9 deletions

View file

@ -138,7 +138,10 @@ class MainActivity : SimpleActivity() {
handlePermission(PERMISSION_READ_CONTACTS) {
initMessenger()
bus = EventBus.getDefault()
bus!!.register(this)
try {
bus!!.register(this)
} catch (e: Exception) {
}
}
} else {
finish()
@ -165,7 +168,12 @@ class MainActivity : SimpleActivity() {
private fun getCachedConversations() {
ensureBackgroundThread {
val conversations = conversationsDB.getAll().sortedByDescending { it.date }.toMutableList() as ArrayList<Conversation>
val conversations = try {
conversationsDB.getAll().sortedByDescending { it.date }.toMutableList() as ArrayList<Conversation>
} catch (e: Exception) {
ArrayList()
}
updateUnreadCountBadge(conversations)
runOnUiThread {
setupConversations(conversations)