]> source.dussan.org Git - jgit.git/commitdiff
Fix NPE on reading global config on MAC 69/2469/1
authorJens Baumgart <jens.baumgart@sap.com>
Wed, 9 Feb 2011 14:12:31 +0000 (15:12 +0100)
committerJens Baumgart <jens.baumgart@sap.com>
Wed, 9 Feb 2011 14:12:31 +0000 (15:12 +0100)
Bug: 336610

Change-Id: Iefcb85e791723801faa315b3ee45fb19e3ca52fb
Signed-off-by: Jens Baumgart <jens.baumgart@sap.com>
org.eclipse.jgit/src/org/eclipse/jgit/util/FS_POSIX.java

index e69596313628d1b07f93d7393a577608d5165489..14fac15df169da454df7a88abb77ad01cafbd321 100644 (file)
@@ -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;