Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Aniszczyk2011-02-09 17:27:36 +0000
committerCode Review2011-02-09 17:27:36 +0000
commitb46e06bc74a411b1e96c1211490102c48b091866 (patch)
tree5fad9ebbff383cc8051dcbaa47e1de5328305bd5
parentc9e4a78555e828e5eecaa6fb0d89b7b460cab48b (diff)
parentb82e4bf7719e75eda2c3e60cdae593a7bd8f6979 (diff)
downloadjgit-b46e06bc74a411b1e96c1211490102c48b091866.tar.gz
jgit-b46e06bc74a411b1e96c1211490102c48b091866.tar.xz
jgit-b46e06bc74a411b1e96c1211490102c48b091866.zip
Merge "Fix NPE on reading global config on MAC" into stable-0.11
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/util/FS_POSIX.java7
1 files changed, 6 insertions, 1 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/FS_POSIX.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/FS_POSIX.java
index e695963136..14fac15df1 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/util/FS_POSIX.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/FS_POSIX.java
@@ -66,7 +66,12 @@ abstract class FS_POSIX extends FS {
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;

Back to the top