防止多次初始化

This commit is contained in:
LeGend-wLw 2024-02-04 16:42:56 +08:00
parent dd8df63b01
commit f7b024f6da
1 changed files with 9 additions and 1 deletions

View File

@ -9,7 +9,15 @@ object TVList {
lateinit var list: Map<String, List<TV>>
fun init(context: Context){
setupTV(context)
if(::list.isInitialized){
return
}
synchronized(this){
if(::list.isInitialized){
return
}
list = setupTV(context)
}
}