Catching another exception in ContactsLoader + prevent crash if cursor is null
This commit is contained in:
parent
4d6f614df8
commit
3599fd21da
1 changed files with 8 additions and 1 deletions
|
@ -71,7 +71,11 @@ class ContactLoader : LoaderManager.LoaderCallbacks<Cursor> {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onLoadFinished(loader: Loader<Cursor>, cursor: Cursor) {
|
override fun onLoadFinished(loader: Loader<Cursor>, cursor: Cursor?) {
|
||||||
|
if (cursor == null) {
|
||||||
|
Log.e("[Contacts Loader] Cursor is null!")
|
||||||
|
return
|
||||||
|
}
|
||||||
Log.i("[Contacts Loader] Load finished, found ${cursor.count} entries in cursor")
|
Log.i("[Contacts Loader] Load finished, found ${cursor.count} entries in cursor")
|
||||||
|
|
||||||
val core = coreContext.core
|
val core = coreContext.core
|
||||||
|
@ -211,6 +215,9 @@ class ContactLoader : LoaderManager.LoaderCallbacks<Cursor> {
|
||||||
}
|
}
|
||||||
} catch (sde: StaleDataException) {
|
} catch (sde: StaleDataException) {
|
||||||
Log.e("[Contacts Loader] State Data Exception: $sde")
|
Log.e("[Contacts Loader] State Data Exception: $sde")
|
||||||
|
} catch (ise: IllegalStateException) {
|
||||||
|
Log.e("[Contacts Loader] Illegal State Exception: $ise")
|
||||||
|
} finally {
|
||||||
cancel()
|
cancel()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue