mirror of
https://github.com/ReVanced/revanced-manager.git
synced 2024-11-10 09:07:47 +01:00
fix: add bounds checks in patch selector
This commit is contained in:
parent
5455cf20ab
commit
a12c5c583b
1 changed files with 3 additions and 1 deletions
|
@ -285,7 +285,7 @@ fun PatchesSelectorScreen(
|
||||||
ExtendedFloatingActionButton(
|
ExtendedFloatingActionButton(
|
||||||
text = { Text(stringResource(R.string.save)) },
|
text = { Text(stringResource(R.string.save)) },
|
||||||
icon = { Icon(Icons.Outlined.Save, null) },
|
icon = { Icon(Icons.Outlined.Save, null) },
|
||||||
expanded = patchLazyListStates[pagerState.currentPage].isScrollingUp,
|
expanded = patchLazyListStates.getOrNull(pagerState.currentPage)?.isScrollingUp ?: true,
|
||||||
onClick = {
|
onClick = {
|
||||||
// TODO: only allow this if all required options have been set.
|
// TODO: only allow this if all required options have been set.
|
||||||
onSave(vm.getCustomSelection(), vm.getOptions())
|
onSave(vm.getCustomSelection(), vm.getOptions())
|
||||||
|
@ -325,6 +325,8 @@ fun PatchesSelectorScreen(
|
||||||
state = pagerState,
|
state = pagerState,
|
||||||
userScrollEnabled = true,
|
userScrollEnabled = true,
|
||||||
pageContent = { index ->
|
pageContent = { index ->
|
||||||
|
// Avoid crashing if the lists have not been fully initialized yet.
|
||||||
|
if (index > bundles.lastIndex || bundles.size != patchLazyListStates.size) return@HorizontalPager
|
||||||
val bundle = bundles[index]
|
val bundle = bundles[index]
|
||||||
|
|
||||||
LazyColumnWithScrollbar(
|
LazyColumnWithScrollbar(
|
||||||
|
|
Loading…
Reference in a new issue