diff options
author | Matthias Sohn <matthias.sohn@sap.com> | 2016-12-29 00:58:40 +0100 |
---|---|---|
committer | Matthias Sohn <matthias.sohn@sap.com> | 2016-12-29 00:59:33 +0100 |
commit | f63267134fe0c18f6fd323a352f834cd8dd889df (patch) | |
tree | b460e7391e947394e728c73c1efb31a44fc77980 /org.eclipse.jgit | |
parent | 48b772bec1b65da04072b4239119da759547865f (diff) | |
download | jgit-f63267134fe0c18f6fd323a352f834cd8dd889df.tar.gz jgit-f63267134fe0c18f6fd323a352f834cd8dd889df.zip |
[findBugs] Fix potential NPE in GC
Change-Id: I59cda76b2c5039e08612f394ee4f7f1788578c49
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Diffstat (limited to 'org.eclipse.jgit')
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/GC.java | 7 |
1 files 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<Path>() { 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<Path> iter = stream.iterator(); iter.hasNext(); |