Skip to content

Commit

Permalink
fix: crash when trying to dearrow feed items
Browse files Browse the repository at this point in the history
  • Loading branch information
Bnyro committed May 7, 2024
1 parent 800d670 commit 278ba4e
Showing 1 changed file with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -212,17 +212,19 @@ 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

Check failure on line 218 in app/src/main/java/com/github/libretube/ui/fragments/SubscriptionsFragment.kt

View workflow job for this annotation

GitHub Actions / Check Code Quality

[ktlint] reported by reviewdog 🐶 A multiline expression should start on a new line Raw Output: app/src/main/java/com/github/libretube/ui/fragments/SubscriptionsFragment.kt:218:43: error: A multiline expression should start on a new line (standard:multiline-expression-wrapping)
.subList(feedAdapter.itemCount, toIndex)
.deArrow()
.toList()

withContext(Dispatchers.Main) {
feedAdapter.insertItems(streamItemsToInsert)
binding.subRefresh.isRefreshing = false
withContext(Dispatchers.IO) {
runCatching { streamItemsToInsert = streamItemsToInsert.deArrow() }
}

feedAdapter.insertItems(streamItemsToInsert)
binding.subRefresh.isRefreshing = false
}
}
}
Expand Down

0 comments on commit 278ba4e

Please sign in to comment.