mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-14 06:10:31 +05:30
fix: crash when trying to dearrow feed items
This commit is contained in:
parent
800d6704cf
commit
278ba4ea32
@ -212,20 +212,22 @@ class SubscriptionsFragment : DynamicLayoutManagerFragment() {
|
||||
if (viewModel.videoFeed.value != null && !isCurrentTabSubChannels && !binding.subRefresh.isRefreshing && hasMore) {
|
||||
binding.subRefresh.isRefreshing = true
|
||||
|
||||
lifecycleScope.launch(Dispatchers.IO) {
|
||||
lifecycleScope.launch {
|
||||
val toIndex = minOf(feedAdapter.itemCount + 10, sortedFeed.size)
|
||||
|
||||
val streamItemsToInsert = sortedFeed
|
||||
var streamItemsToInsert = sortedFeed
|
||||
.subList(feedAdapter.itemCount, toIndex)
|
||||
.deArrow()
|
||||
.toList()
|
||||
|
||||
withContext(Dispatchers.IO) {
|
||||
runCatching { streamItemsToInsert = streamItemsToInsert.deArrow() }
|
||||
}
|
||||
|
||||
withContext(Dispatchers.Main) {
|
||||
feedAdapter.insertItems(streamItemsToInsert)
|
||||
binding.subRefresh.isRefreshing = false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun setupSortAndFilter() {
|
||||
binding.filterSort.setOnClickListener {
|
||||
|
Loading…
Reference in New Issue
Block a user