From 6c64148f666dad0046086b65eb4912dafafe7a20 Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Thu, 11 Mar 2010 10:47:12 -0800 Subject: [PATCH] pgm: Report not in git repository rather than NPE 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 Reviewed-by: Robin Rosenberg --- org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Main.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Main.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Main.java index 10ebef463..f1191a459 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Main.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Main.java @@ -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;