Skip to content

Commit

Permalink
Fix JDK combobox using unknown JDK version
Browse files Browse the repository at this point in the history
  • Loading branch information
RedNesto committed Dec 20, 2023
1 parent ee61ae7 commit f402f97
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/main/kotlin/creator/JdkComboBoxWithPreference.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit f402f97

Please sign in to comment.