Merge "Fix NPE on reading global config on MAC" into stable-0.11

This commit is contained in:
Chris Aniszczyk 2011-02-09 12:27:36 -05:00 committed by Code Review
commit b46e06bc74
1 changed files with 6 additions and 1 deletions

View File

@ -66,7 +66,12 @@ public File gitPrefix() {
String w = readPipe(userHome(), //
new String[] { "bash", "--login", "-c", "which git" }, //
Charset.defaultCharset().name());
return new File(w).getParentFile().getParentFile();
if (w == null || w.length() == 0)
return null;
File parentFile = new File(w).getParentFile();
if (parentFile == null)
return null;
return parentFile.getParentFile();
}
return null;