[platform] another NPE on detecting a name of a project located in a Windows disk root

GitOrigin-RevId: 2ef104eb03cb95d985a77685c2fdce2e59572084
This commit is contained in:
Roman Shevchenko
2020-01-29 16:06:47 +00:00
committed by intellij-monorepo-bot
parent 61335a0d91
commit 1dd5523f77
@@ -99,6 +99,12 @@ public class JpsPathUtil {
public static @NotNull String getDefaultProjectName(@NotNull Path projectDir) {
Path parent = projectDir.getParent();
return parent != null ? parent.getFileName().toString() : UNNAMED_PROJECT;
if (parent != null) {
Path name = parent.getFileName(); // `null` when parent is a Windows disk root
return name != null ? name.toString() : parent.toString();
}
else {
return UNNAMED_PROJECT;
}
}
}