Skip to content

Commit b08c380

Browse files
committed
fix: NPE in findExecutableAbsolutePath if PATH isn't set
1 parent 15cbc35 commit b08c380

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

build-tools-lib/src/main/kotlin/org/modelix/buildtools/BuildScriptGenerator.kt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -961,9 +961,10 @@ class BuildScriptGenerator(
961961
private fun getIdeaPluginsBuildDir(buildDir: File) = buildDir.resolve("idea-plugins")
962962

963963
fun findExecutableAbsolutePath(name: String): String {
964-
return System.getenv("PATH").split(File.pathSeparatorChar)
965-
.map { File(it).resolve(name) }
966-
.firstOrNull { it.isFile && it.exists() }
964+
return System.getenv("PATH")
965+
?.split(File.pathSeparatorChar)
966+
?.map { File(it).resolve(name) }
967+
?.firstOrNull { it.isFile && it.exists() }
967968
?.absolutePath
968969
?: name
969970
}

0 commit comments

Comments
 (0)