Avoid crash when trying to open random entry but categories are still loading
Fixes #9610 (cherry picked from commit 0871208023b46452fbf26f9baebea82cecb33f39)
This commit is contained in:
parent
bf0dee8d03
commit
2f360a3fd7
@ -794,6 +794,8 @@ class LibraryScreenModel(
|
|||||||
}
|
}
|
||||||
|
|
||||||
suspend fun getRandomLibraryItemForCurrentCategory(): LibraryItem? {
|
suspend fun getRandomLibraryItemForCurrentCategory(): LibraryItem? {
|
||||||
|
if (state.value.categories.isEmpty()) return null
|
||||||
|
|
||||||
return withIOContext {
|
return withIOContext {
|
||||||
state.value
|
state.value
|
||||||
.getLibraryItemsByCategoryId(state.value.categories[activeCategoryIndex].id)
|
.getLibraryItemsByCategoryId(state.value.categories[activeCategoryIndex].id)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user