diff --git a/store/src/commonMain/kotlin/org/mobilenativefoundation/store/store5/impl/RealMutableStore.kt b/store/src/commonMain/kotlin/org/mobilenativefoundation/store/store5/impl/RealMutableStore.kt index f5dbb54f9..84fd02948 100644 --- a/store/src/commonMain/kotlin/org/mobilenativefoundation/store/store5/impl/RealMutableStore.kt +++ b/store/src/commonMain/kotlin/org/mobilenativefoundation/store/store5/impl/RealMutableStore.kt @@ -203,10 +203,13 @@ internal class RealMutableStore Output, ): Output { storeLock.lock() - val threadSafety = requireNotNull(keyToThreadSafety[key]) - val output = threadSafety.block() - storeLock.unlock() - return output + try { + val threadSafety = requireNotNull(keyToThreadSafety[key]) + val output = threadSafety.block() + return output + } finally { + storeLock.unlock() + } } private suspend fun conflictsMightExist(key: Key): Boolean {