[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
This commit is contained in:
Karima Ichou
2025-02-11 19:40:47 +00:00
committed by intellij-monorepo-bot
parent 617b47e26e
commit 08e60ab334
@@ -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)