From f63267134fe0c18f6fd323a352f834cd8dd889df Mon Sep 17 00:00:00 2001 From: Matthias Sohn Date: Thu, 29 Dec 2016 00:58:40 +0100 Subject: [PATCH] [findBugs] Fix potential NPE in GC Change-Id: I59cda76b2c5039e08612f394ee4f7f1788578c49 Signed-off-by: Matthias Sohn --- .../src/org/eclipse/jgit/internal/storage/file/GC.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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 147e54dce8..560db92401 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(); -- 2.39.5