diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/GC.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/GC.java index 147e54dce..560db9240 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/GC.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/GC.java @@ -1204,9 +1204,10 @@ public class GC { new DirectoryStream.Filter() { public boolean accept(Path file) throws IOException { - return Files.isRegularFile(file) && PATTERN_LOOSE_OBJECT - .matcher(file.getFileName().toString()) - .matches(); + Path fileName = file.getFileName(); + return Files.isRegularFile(file) && fileName != null + && PATTERN_LOOSE_OBJECT + .matcher(fileName.toString()).matches(); } })) { for (Iterator iter = stream.iterator(); iter.hasNext();