diff --git a/app/src/main/java/com/topjohnwu/magisk/utils/CachedValue.kt b/app/src/main/java/com/topjohnwu/magisk/utils/CachedValue.kt index b4b6f6a80..889eb9fa0 100644 --- a/app/src/main/java/com/topjohnwu/magisk/utils/CachedValue.kt +++ b/app/src/main/java/com/topjohnwu/magisk/utils/CachedValue.kt @@ -8,9 +8,7 @@ class CachedValue(private val factory: () -> T) : Lazy { get() { val local = _val return local ?: synchronized(this) { - val newInstance = factory() - _val = newInstance - newInstance + _val ?: factory().also { _val = it } } }