Browse Source

[findBugs] Fix potential NPE in GC

Change-Id: I59cda76b2c5039e08612f394ee4f7f1788578c49
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
stable-4.7
Matthias Sohn 8 years ago
parent
commit
f63267134f
  1. 7
      org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/GC.java

7
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();

Loading…
Cancel
Save