mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-11-24 02:25:28 +00:00
Minor CachedValue fix
This commit is contained in:
parent
25c64db0a1
commit
c30be20e49
@ -8,9 +8,7 @@ class CachedValue<T>(private val factory: () -> T) : Lazy<T> {
|
|||||||
get() {
|
get() {
|
||||||
val local = _val
|
val local = _val
|
||||||
return local ?: synchronized(this) {
|
return local ?: synchronized(this) {
|
||||||
val newInstance = factory()
|
_val ?: factory().also { _val = it }
|
||||||
_val = newInstance
|
|
||||||
newInstance
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user