Skip to content

Commit df9c3e1

Browse files
author
Vladimir Kotal
committed
be more robust
1 parent 7b79f34 commit df9c3e1

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

opengrok-indexer/src/main/java/org/opengrok/indexer/util/FileExtraZipper.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,7 @@ public class FileExtraZipper {
4545
* @param extras some OpenGrok-analyzed extra metadata
4646
* @return a list of the same size as {@code files}
4747
*/
48-
public List<DirectoryEntry> zip(File dir, List<String> files,
49-
List<FileExtra> extras) {
48+
public List<DirectoryEntry> zip(File dir, List<String> files, List<FileExtra> extras) {
5049

5150
if (extras == null) {
5251
return files.stream().map(f ->
@@ -75,9 +74,11 @@ private FileExtra findExtra(Map<String, FileExtra> byName, File fileobj) {
7574
private Map<String, FileExtra> indexExtraByName(List<FileExtra> extras) {
7675
Map<String, FileExtra> byPath = new HashMap<>();
7776
for (FileExtra extra : extras) {
78-
File f = new File(extra.getFilepath());
79-
String filename = f.getName();
80-
byPath.put(filename, extra);
77+
if (extra.getFilepath() != null) {
78+
File f = new File(extra.getFilepath());
79+
String filename = f.getName();
80+
byPath.put(filename, extra);
81+
}
8182
}
8283
return byPath;
8384
}

0 commit comments

Comments
 (0)