Skip to content

Commit

Permalink
fix: Potential crash in carousel (IndexOutOfBounds)
Browse files Browse the repository at this point in the history
  • Loading branch information
Lastaapps committed Feb 28, 2025
1 parent 078fb46 commit 6da38a5
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,12 @@ private fun DishContent(
.fillMaxWidth(),
// .animateItem(),
) { index ->
val dish = category.dishList[index]
// As the carousel component is broken in almost every way,
// higher index from previous dish list is provided to new items
// therefore we need to check if the index is valid
val dish =
category.dishList.getOrNull(index)
?: return@HorizontalMultiBrowseCarousel

// outside so the computation is run one only
// even if progress is called multiple times
Expand Down

0 comments on commit 6da38a5

Please sign in to comment.