diff --git a/CHANGELOG.md b/CHANGELOG.md index 1770c58..12c50e1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ - Date format: YYYY-MM-dd +## v1.2.14/ 2024-xx-xx + +Fixed the function `MMKV_KMP.withOpen` + ## v1.2.13 / 2024-07-16 * Based on `Kotlin 1.9.24`, `MMKV 1.3.7` diff --git a/build.gradle.kts b/build.gradle.kts index ecc902d..2ebb064 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,5 +1,5 @@ plugins { - alias(libs.plugins.multiplatform).apply(false) - alias(libs.plugins.cocoapods).apply(false) - alias(libs.plugins.android.library).apply(false) + alias(libs.plugins.multiplatform) apply false + alias(libs.plugins.cocoapods) apply false + alias(libs.plugins.android.library) apply false } \ No newline at end of file diff --git a/mmkv-kotlin/src/commonMain/kotlin/com/ctrip/flight/mmkv/Extension.kt b/mmkv-kotlin/src/commonMain/kotlin/com/ctrip/flight/mmkv/Extension.kt index 5b8fdd0..0adbf75 100644 --- a/mmkv-kotlin/src/commonMain/kotlin/com/ctrip/flight/mmkv/Extension.kt +++ b/mmkv-kotlin/src/commonMain/kotlin/com/ctrip/flight/mmkv/Extension.kt @@ -21,8 +21,8 @@ package com.ctrip.flight.mmkv * @author yaqiao */ -inline fun MMKV_KMP.withOpen(block: MMKV_KMP.() -> T): T { - val result = block() +inline fun MMKV_KMP.withOpen(block: MMKV_KMP.() -> T): T = try { + block() +} finally { close() - return result } \ No newline at end of file