diff --git a/libsignal/src/main/java/org/session/libsignal/utilities/Snode.kt b/libsignal/src/main/java/org/session/libsignal/utilities/Snode.kt index 58dcbe8a37..288c3fcf1d 100644 --- a/libsignal/src/main/java/org/session/libsignal/utilities/Snode.kt +++ b/libsignal/src/main/java/org/session/libsignal/utilities/Snode.kt @@ -42,10 +42,7 @@ class Snode(val address: String, val port: Int, val publicKeySet: KeySet?, val v private val CACHE = mutableMapOf() @SuppressLint("NotConstructor") - fun Version(value: String) = CACHE.getOrElse(value) { - // internal constructor takes precedence - Snode.Version(value) - } + fun Version(value: String) = CACHE[value] ?: Snode.Version(value).also { CACHE[value] = it } fun Version(parts: List) = Version(parts.joinToString(".")) }