[fix] Crash while empty class set
This commit is contained in:
@@ -298,27 +298,6 @@ fun CatalogueItemRow(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@OptIn(ExperimentalMaterial3Api::class)
|
|
||||||
@Composable
|
|
||||||
fun TopRow(videoScreenViewModel: VideoScreenViewModel) {
|
|
||||||
val tabIndex by videoScreenViewModel.tabIndex;
|
|
||||||
if (videoScreenViewModel.videoLibrary.classes.isEmpty()) return
|
|
||||||
val colorScheme = MaterialTheme.colorScheme
|
|
||||||
|
|
||||||
ScrollableTabRow(
|
|
||||||
selectedTabIndex = tabIndex,
|
|
||||||
modifier = Modifier.background(colorScheme.surface)
|
|
||||||
) {
|
|
||||||
videoScreenViewModel.videoLibrary.classes.forEachIndexed { index, title ->
|
|
||||||
Tab(
|
|
||||||
selected = tabIndex == index,
|
|
||||||
onClick = { videoScreenViewModel.setTabIndex(index) },
|
|
||||||
text = { Text(text = title, maxLines = 1) },
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun VideoCard(
|
fun VideoCard(
|
||||||
video: Video,
|
video: Video,
|
||||||
|
|||||||
@@ -53,6 +53,9 @@ class VideoScreenViewModel @Inject constructor(
|
|||||||
|
|
||||||
if (Global.loggedIn) {
|
if (Global.loggedIn) {
|
||||||
videoLibrary.classes.addAll(mediaManager.listVideoKlasses())
|
videoLibrary.classes.addAll(mediaManager.listVideoKlasses())
|
||||||
|
if(videoLibrary.classes.isEmpty())
|
||||||
|
return
|
||||||
|
|
||||||
var i = 0
|
var i = 0
|
||||||
for (it in videoLibrary.classes) {
|
for (it in videoLibrary.classes) {
|
||||||
videoLibrary.updatingMap[i++] = false
|
videoLibrary.updatingMap[i++] = false
|
||||||
|
|||||||
Reference in New Issue
Block a user