From 1e1828e894688fc0b1b66db4827f908649ed1a96 Mon Sep 17 00:00:00 2001 From: Todd York Date: Thu, 12 Dec 2024 21:31:49 +0800 Subject: [PATCH] Fix crash when editing tabs --- .../org/sunsetware/phocid/ui/views/LibraryScreenHomeView.kt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/org/sunsetware/phocid/ui/views/LibraryScreenHomeView.kt b/app/src/main/java/org/sunsetware/phocid/ui/views/LibraryScreenHomeView.kt index 032ec32..96e5a94 100644 --- a/app/src/main/java/org/sunsetware/phocid/ui/views/LibraryScreenHomeView.kt +++ b/app/src/main/java/org/sunsetware/phocid/ui/views/LibraryScreenHomeView.kt @@ -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() @@ -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 {} } } }