diff --git a/src/main/kotlin/ru/dbotthepony/kstarbound/util/PathStack.kt b/src/main/kotlin/ru/dbotthepony/kstarbound/util/PathStack.kt index eeafbe4f..9d34708a 100644 --- a/src/main/kotlin/ru/dbotthepony/kstarbound/util/PathStack.kt +++ b/src/main/kotlin/ru/dbotthepony/kstarbound/util/PathStack.kt @@ -4,8 +4,13 @@ import com.github.benmanes.caffeine.cache.Interner import kotlin.concurrent.getOrSet class PathStack(private val interner: Interner = Interner { it }) { - private val _stack = ThreadLocal>() - private val stack: ArrayDeque get() = _stack.getOrSet { ArrayDeque() } + private val _stack = object : ThreadLocal>() { + override fun initialValue(): ArrayDeque { + return ArrayDeque() + } + } + + private val stack: ArrayDeque get() = _stack.get() fun push(value: String) { stack.addLast(value)