From 13bb45b4bee6e31685d47a4157e10bcedf111bf0 Mon Sep 17 00:00:00 2001 From: 0x7673 <123292609+0x7673@users.noreply.github.com> Date: Wed, 8 Feb 2023 08:49:46 +0530 Subject: [PATCH] Fix crash in library when selected category is deleted (#9044) --- .../kanade/presentation/library/components/LibraryContent.kt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/src/main/java/eu/kanade/presentation/library/components/LibraryContent.kt b/app/src/main/java/eu/kanade/presentation/library/components/LibraryContent.kt index cf1f2a2ef..b8ccc2f11 100644 --- a/app/src/main/java/eu/kanade/presentation/library/components/LibraryContent.kt +++ b/app/src/main/java/eu/kanade/presentation/library/components/LibraryContent.kt @@ -60,6 +60,9 @@ fun LibraryContent( var isRefreshing by remember(pagerState.currentPage) { mutableStateOf(false) } if (showPageTabs && categories.size > 1) { + if (categories.size <= pagerState.currentPage) { + pagerState.currentPage = categories.size - 1 + } LibraryTabs( categories = categories, currentPageIndex = pagerState.currentPage,