summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorJens Baumgart2011-02-09 09:12:31 (EST)
committer Jens Baumgart2011-02-09 09:12:31 (EST)
commitb82e4bf7719e75eda2c3e60cdae593a7bd8f6979 (patch)
tree5462f1b183a38dbc5665dad291d6764bcd8dca34
parent724af77c65c27eb24d41989bed3229910dbe063c (diff)
downloadjgit-b82e4bf7719e75eda2c3e60cdae593a7bd8f6979.zip
jgit-b82e4bf7719e75eda2c3e60cdae593a7bd8f6979.tar.gz
jgit-b82e4bf7719e75eda2c3e60cdae593a7bd8f6979.tar.bz2
Fix NPE on reading global config on MACrefs/changes/69/2469/1
Bug: 336610 Change-Id: Iefcb85e791723801faa315b3ee45fb19e3ca52fb Signed-off-by: Jens Baumgart <jens.baumgart@sap.com>
-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 e695963..14fac15 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;