]> source.dussan.org Git - jgit.git/commitdiff
pgm: Report not in git repository rather than NPE 36/336/2
authorShawn O. Pearce <spearce@spearce.org>
Thu, 11 Mar 2010 18:47:12 +0000 (10:47 -0800)
committerShawn O. Pearce <spearce@spearce.org>
Thu, 11 Mar 2010 23:15:03 +0000 (15:15 -0800)
If we can't find a Git repository after searching all the way up
to the filesystem root, JGit threw an NPE because we tried to get
the path of null.

Change-Id: I4e42364aeba53993c0ea528a9aeba3f08c7b3321
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Reviewed-by: Robin Rosenberg <robin.rosenberg@dewire.com>
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Main.java

index 10ebef4637ae539a1ae39ce5b6aa2e011f866a7d..f1191a4599298ebee10e853df293acac981f5c8f 100644 (file)
@@ -232,7 +232,8 @@ public class Main {
                        if (gitDir.isDirectory())
                                return gitDir;
                        current = current.getParentFile();
-                       if (ceilingDirectories.contains(current.getPath()))
+                       if (current != null
+                                       && ceilingDirectories.contains(current.getPath()))
                                break;
                }
                return null;