Skip to content

Commit

Permalink
Fix crash after removing last category while it's active in library (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
cuong-tran authored Nov 7, 2024
1 parent 57e6e19 commit 9df2158
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,20 @@ internal fun LibraryTabs(
getNumberOfMangaForCategory: (Category) -> Int?,
onTabItemClick: (Int) -> Unit,
) {
val currentPageIndex = pagerState.currentPage.coerceAtMost(categories.lastIndex)
Column(
modifier = Modifier.zIndex(1f),
) {
PrimaryScrollableTabRow(
selectedTabIndex = pagerState.currentPage,
selectedTabIndex = currentPageIndex,
edgePadding = 0.dp,
// TODO: use default when width is fixed upstream
// https://issuetracker.google.com/issues/242879624
divider = {},
) {
categories.forEachIndexed { index, category ->
Tab(
selected = pagerState.currentPage == index,
selected = currentPageIndex == index,
onClick = { onTabItemClick(index) },
text = {
TabText(
Expand Down

0 comments on commit 9df2158

Please sign in to comment.