From f402f97a2baae12ff39239239bde8caa74238430 Mon Sep 17 00:00:00 2001 From: RedNesto Date: Wed, 20 Dec 2023 19:08:48 +0100 Subject: [PATCH] Fix JDK combobox using unknown JDK version --- src/main/kotlin/creator/JdkComboBoxWithPreference.kt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/kotlin/creator/JdkComboBoxWithPreference.kt b/src/main/kotlin/creator/JdkComboBoxWithPreference.kt index 21cb22597..bc8619687 100644 --- a/src/main/kotlin/creator/JdkComboBoxWithPreference.kt +++ b/src/main/kotlin/creator/JdkComboBoxWithPreference.kt @@ -144,7 +144,12 @@ fun Row.jdkComboBoxWithPreference( stateComponent.getList(preferenceDataProperty)?.let { preferenceDataStrs -> for (preferenceDataStr in preferenceDataStrs) { val parts = preferenceDataStr.split('=', limit = 2) - val jdk = parts.firstOrNull()?.toIntOrNull()?.let { JavaSdkVersion.values()[it] } ?: continue + val featureVersion = parts.firstOrNull()?.toIntOrNull() ?: continue + val knownJdkVersions = JavaSdkVersion.values() + if (featureVersion !in knownJdkVersions.indices) { + continue + } + val jdk = knownJdkVersions[featureVersion] val sdk = parts.last() preferenceData.sdkPathByJdk[jdk] = sdk }