diff --git a/okhttp/src/main/kotlin/okhttp3/internal/cache/CacheLock.kt b/okhttp/src/main/kotlin/okhttp3/internal/cache/CacheLock.kt index c112fd4800e4..8ad1a92c527c 100644 --- a/okhttp/src/main/kotlin/okhttp3/internal/cache/CacheLock.kt +++ b/okhttp/src/main/kotlin/okhttp3/internal/cache/CacheLock.kt @@ -32,7 +32,11 @@ internal object CacheLock { fileSystem: FileSystem, directory: Path, ): Closeable { - return if (fileSystem == FileSystem.SYSTEM && !Platform.isAndroid) { + if (fileSystem != FileSystem.SYSTEM) { + return Closeable {} + } + + return if (!Platform.isAndroid) { fileSystemLock(inMemoryLock(directory), directory) } else { inMemoryLock(directory)