mirror of
https://github.com/etesync/android
synced 2024-11-22 16:08:13 +00:00
Account list: workaround rare crash when listing accounts.
This commit is contained in:
parent
2758821e5b
commit
58b54f9d66
@ -77,8 +77,13 @@ class AccountListFragment : ListFragment(), LoaderManager.LoaderCallbacks<Array<
|
|||||||
override fun onStartLoading() =
|
override fun onStartLoading() =
|
||||||
accountManager.addOnAccountsUpdatedListener(this, null, true)
|
accountManager.addOnAccountsUpdatedListener(this, null, true)
|
||||||
|
|
||||||
override fun onStopLoading() =
|
override fun onStopLoading() {
|
||||||
|
try {
|
||||||
accountManager.removeOnAccountsUpdatedListener(this)
|
accountManager.removeOnAccountsUpdatedListener(this)
|
||||||
|
} catch (e: IllegalArgumentException) {
|
||||||
|
// Do nothing. Just handle the case where for some reason the listener is not registered.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
override fun onAccountsUpdated(accounts: Array<Account>) {
|
override fun onAccountsUpdated(accounts: Array<Account>) {
|
||||||
forceLoad()
|
forceLoad()
|
||||||
|
Loading…
Reference in New Issue
Block a user