Merge pull request #5038 from k9mail/fix_message_list_loading
Don't crash when MessageListLoader couldn't retrieve any Cursors
This commit is contained in:
commit
37c391f596
1 changed files with 9 additions and 4 deletions
|
@ -45,14 +45,19 @@ class MessageListLoader(
|
|||
.mapNotNull { loadMessageListForAccount(it, config) }
|
||||
.toTypedArray()
|
||||
|
||||
if (cursors.isEmpty()) {
|
||||
Timber.w("Couldn't get message list")
|
||||
return MessageListInfo(messageListItems = emptyList(), hasMoreMessages = false)
|
||||
}
|
||||
|
||||
val cursor: Cursor
|
||||
val uniqueIdColumn: Int
|
||||
if (cursors.size > 1) {
|
||||
cursor = MergeCursorWithUniqueId(cursors, getComparator(config))
|
||||
uniqueIdColumn = cursor.getColumnIndex("_id")
|
||||
} else {
|
||||
if (cursors.size == 1) {
|
||||
cursor = cursors[0]
|
||||
uniqueIdColumn = MLFProjectionInfo.ID_COLUMN
|
||||
} else {
|
||||
cursor = MergeCursorWithUniqueId(cursors, getComparator(config))
|
||||
uniqueIdColumn = cursor.getColumnIndex("_id")
|
||||
}
|
||||
|
||||
val messageListItems = cursor.use {
|
||||
|
|
Loading…
Reference in a new issue