Skip to content

Commit

Permalink
Fix crash when editing tabs
Browse files Browse the repository at this point in the history
  • Loading branch information
TJYSunset committed Dec 12, 2024
1 parent b5ef519 commit 1e1828e
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ fun LibraryScreenHomeView(
Column {
ViewTabRow(preferences, state)
HorizontalPager(state = pagerState, beyondViewportPageCount = Int.MAX_VALUE) { i ->
if (state.tabStates.size > i) {
if (preferences.tabs.size > i && state.tabStates.size > i) {
val tab = preferences.tabs[i]
val (multiSelectState, lazyGridState) = state.tabStates[tab.type]!!
val items by multiSelectState.items.collectAsStateWithLifecycle()
Expand All @@ -478,6 +478,9 @@ fun LibraryScreenHomeView(
cardShape = preferences.shapePreference.cardShape,
coloredCards = preferences.coloredCards,
)
} else {
// Not providing a composable will cause internal crash in pager
Box {}
}
}
}
Expand Down

0 comments on commit 1e1828e

Please sign in to comment.