Skip to content

Commit

Permalink
Merge pull request #455 from yu-shiba/fix-npe-for-env_home-returns-null
Browse files Browse the repository at this point in the history
NPE System.getenv(ENV_HOME) returns null on Windows
  • Loading branch information
k8s-ci-robot committed Dec 6, 2018
2 parents 43a48b0 + cbce44e commit e750b98
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,12 @@ private static File findConfigFromEnv() {
}

private static File findHomeDir() {
final File config = new File(System.getenv(ENV_HOME));
if (config.exists()) {
return config;
final String envHome = System.getenv(ENV_HOME);
if (envHome != null && envHome.length() > 0) {
final File config = new File(envHome);
if (config.exists()) {
return config;
}
}
if (System.getProperty("os.name").toLowerCase().startsWith("windows")) {
String homeDrive = System.getenv("HOMEDRIVE");
Expand Down

0 comments on commit e750b98

Please sign in to comment.