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 437bc41c4..19c839aff 100644 --- a/app/src/main/java/io/legado/app/service/CheckSourceService.kt +++ b/app/src/main/java/io/legado/app/service/CheckSourceService.kt @@ -64,7 +64,9 @@ class CheckSourceService : BaseService() { private fun check() { - processIndex++ + synchronized(this) { + processIndex++ + } if (processIndex < allIds.size) { val sourceUrl = allIds[processIndex] @@ -81,8 +83,10 @@ class CheckSourceService : BaseService() { checkedIds.size, getString(R.string.progress_show, checkedIds.size, allIds.size) ) - if (processIndex >= allIds.size + threadCount - 1) { - stopSelf() + synchronized(this) { + if (processIndex >= allIds.size + threadCount - 1) { + stopSelf() + } } } }