Skip to content

Commit 6621b7f

Browse files
Fix NPE
1 parent fa98a92 commit 6621b7f

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

app/src/main/java/org/schabi/newpipe/ui/components/items/ItemList.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ fun ItemList(
9797
}
9898

9999
items(items.itemCount) {
100-
val item = items[it]!!
100+
val item = items[it]
101101
val isSelected = selectedStream == item
102102

103103
// TODO: Implement playlist and channel grid items.

app/src/main/java/org/schabi/newpipe/ui/screens/HistoryScreen.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,9 @@ fun HistoryScreen(viewModel: HistoryViewModel = viewModel()) {
5757
val context = LocalContext.current
5858
val sortKey by viewModel.sortKey.collectAsStateWithLifecycle()
5959
val historyItems = viewModel.historyItems.collectAsLazyPagingItems()
60-
val queue = SinglePlayQueue(historyItems.itemSnapshotList.map { it!!.toStreamInfoItem() }, 0)
60+
61+
val streams = historyItems.itemSnapshotList.mapNotNull { it?.toStreamInfoItem() }
62+
val queue = SinglePlayQueue(streams, 0)
6163
val onClickBackground = {
6264
NavigationHelper.playOnBackgroundPlayer(context, queue, false)
6365
}

0 commit comments

Comments
 (0)