Skip to content

Commit 3ab6ede

Browse files
committed
fix(MenuDrawer): Fix indexOutOfBounds exception
1 parent bbc74a2 commit 3ab6ede

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

app/src/main/java/com/infomaniak/mail/ui/main/menuDrawer/MenuDrawerAdapter.kt

+2
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,8 @@ class MenuDrawerAdapter @Inject constructor() : ListAdapter<Any, MenuDrawerViewH
8282

8383
private fun MutableList<Any>.addMailboxes(mailboxes: List<Mailbox>, areMailboxesExpanded: Boolean) {
8484
val currentMailboxIndex = mailboxes.indexOfFirst { it.mailboxId == AccountUtils.currentMailboxId }
85+
if (mailboxes.isEmpty() || currentMailboxIndex == -1) return
86+
8587
val otherMailboxes = mailboxes.toMutableList()
8688
val currentMailbox = otherMailboxes.removeAt(currentMailboxIndex)
8789

0 commit comments

Comments
 (0)