Commit 75219f68 authored by 周文华's avatar 周文华

【修复】添加协程异常处理,尝试修复偶现的网络不好导致的数据问题

parent e7d237e2
......@@ -8,6 +8,7 @@ import com.google.gson.Gson
import com.google.gson.reflect.TypeToken
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.SupervisorJob
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import org.json.JSONObject
......@@ -42,7 +43,7 @@ object NewComUtils {
fun requestCfg(callback: () -> Unit) {
CoroutineScope(Dispatchers.IO).launch {
CoroutineScope(SupervisorJob() +Dispatchers.IO).launch {
val response = doGet()
if (response == null) {
withContext(Dispatchers.Main) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment