diff --git a/app/src/main/java/io/legado/app/service/CheckSourceService.kt b/app/src/main/java/io/legado/app/service/CheckSourceService.kt index c7d2ef2a7..bb803b9cb 100644 --- a/app/src/main/java/io/legado/app/service/CheckSourceService.kt +++ b/app/src/main/java/io/legado/app/service/CheckSourceService.kt @@ -17,6 +17,7 @@ import kotlinx.coroutines.Dispatchers.IO import kotlinx.coroutines.asCoroutineDispatcher import org.jetbrains.anko.toast import java.util.concurrent.Executors +import kotlin.math.min class CheckSourceService : BaseService() { private val threadCount = AppConfig.threadCount @@ -58,7 +59,7 @@ class CheckSourceService : BaseService() { allIds.addAll(ids) processIndex = 0 updateNotification(0, getString(R.string.progress_show, 0, allIds.size)) - for (i in 0 until threadCount) { + for (i in 0 until min(threadCount, allIds.size)) { check() } }