1
0
mirror of https://github.com/TwidereProject/Twidere-Android synced 2025-01-18 19:20:09 +01:00

catches an exception that shouldn't happen

This commit is contained in:
Mariotaku Lee 2016-12-13 08:37:38 +08:00
parent 360bfd7713
commit e3a28a1571

View File

@ -93,12 +93,20 @@ class DirectMessagesFragment : AbsContentListRecyclerViewFragment<MessageEntries
override fun onStart() {
super.onStart()
bus.register(this)
AccountManager.get(context).addOnAccountsUpdatedListener(accountListener, null, false)
try {
AccountManager.get(context).addOnAccountsUpdatedListener(accountListener, null, false)
} catch (e: IllegalStateException) {
// This really shouldn't happen.
}
adapter.updateReadState()
}
override fun onStop() {
AccountManager.get(context).removeOnAccountsUpdatedListener(accountListener)
try {
AccountManager.get(context).removeOnAccountsUpdatedListener(accountListener)
} catch (e: IllegalStateException) {
// This really shouldn't happen.
}
bus.unregister(this)
super.onStop()
}