修复不选择书源校验导致的crash

pull/1259/head
Jason Yao 4 years ago
parent b81e451304
commit 71ced5920b
  1. 6
      app/src/main/java/io/legado/app/ui/book/source/manage/BookSourceActivity.kt

@ -456,10 +456,10 @@ class BookSourceActivity : VMBaseActivity<ActivityBookSourceBinding, BookSourceV
} }
private fun checkMessageRefreshJob(): Job { private fun checkMessageRefreshJob(): Job {
val firstIndex = adapter.getItems().indexOf(adapter.selection.first()) val firstIndex = adapter.getItems().indexOf(adapter.selection.firstOrNull())
val lastIndex = adapter.getItems().indexOf(adapter.selection.last()) val lastIndex = adapter.getItems().indexOf(adapter.selection.lastOrNull())
var refreshCount = 0 var refreshCount = 0
Debug.isChecking = true Debug.isChecking = firstIndex >= 0 && lastIndex >= 0
return async(start = CoroutineStart.LAZY) { return async(start = CoroutineStart.LAZY) {
flow { flow {
while (true) { while (true) {

Loading…
Cancel
Save