diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryScreenModel.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryScreenModel.kt index cbc7bfbea..fa982d322 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryScreenModel.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryScreenModel.kt @@ -527,6 +527,8 @@ class LibraryScreenModel( } suspend fun getRandomLibraryItemForCurrentCategory(): LibraryItem? { + if (state.value.categories.isEmpty()) return null + return withIOContext { state.value .getLibraryItemsByCategoryId(state.value.categories[activeCategoryIndex].id)