From 08e60ab334209019dbca01bd226ada71a70012bd Mon Sep 17 00:00:00 2001 From: Karima Ichou Date: Thu, 9 Jan 2025 13:15:53 +0000 Subject: [PATCH] [IJPL-174685] Do not continue processing if kotlin data node is null the search for the dataNode uses a name comparison, and for the case of Android for example, the names won't match and we will end up finding nothing. The function should not continue processing data if the dataNode is null because it will just use fallbacks instead of configuring the right way. For the NAdroid case, we even have our own data service that actually passes the right name in this case. closes https://github.com/JetBrains/intellij-community/pull/2898 GitOrigin-RevId: 96428ded562d3ff92e2de915e5afc4ae92384cd7 --- .../configuration/KotlinGradleSourceSetDataService.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/kotlin/gradle/gradle-java/src/org/jetbrains/kotlin/idea/gradleJava/configuration/KotlinGradleSourceSetDataService.kt b/plugins/kotlin/gradle/gradle-java/src/org/jetbrains/kotlin/idea/gradleJava/configuration/KotlinGradleSourceSetDataService.kt index 5057babc481a..c3fc97af9562 100644 --- a/plugins/kotlin/gradle/gradle-java/src/org/jetbrains/kotlin/idea/gradleJava/configuration/KotlinGradleSourceSetDataService.kt +++ b/plugins/kotlin/gradle/gradle-java/src/org/jetbrains/kotlin/idea/gradleJava/configuration/KotlinGradleSourceSetDataService.kt @@ -256,9 +256,9 @@ fun configureFacetByGradleModule( val platformKind = detectPlatformKindByPlugin(moduleNode) ?: detectPlatformByLibrary(moduleNode) val kotlinGradleSourceSetDataNode = kotlinGradleProjectDataNode.findAll(KotlinGradleSourceSetData.KEY) - .firstOrNull { it.data.sourceSetName == sourceSetName } + .firstOrNull { it.data.sourceSetName == sourceSetName } ?: return null - val compilerVersion = kotlinGradleSourceSetDataNode?.data?.kotlinPluginVersion?.let(IdeKotlinVersion::opt) + val compilerVersion = kotlinGradleSourceSetDataNode.data?.kotlinPluginVersion?.let(IdeKotlinVersion::opt) // required for GradleFacetImportTest.{testCommonImportByPlatformPlugin, testKotlinAndroidPluginDetection} ?: KotlinGradleFacade.getInstance()?.findKotlinPluginVersion(moduleNode)