Skip to content

Commit 763af11

Browse files
committed
Update FileUtils#findFirstFile to conform to specifications
1 parent f01e4f0 commit 763af11

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/main/java/io/github/fvarrui/javapackager/utils/FileUtils.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,9 @@ public static List<File> findFiles(File searchFolder, String regex) {
303303
*/
304304
public static File findFirstFile(File searchFolder, String regex) {
305305
return Arrays.asList(searchFolder.listFiles((dir, name) -> Pattern.matches(regex, name))).stream()
306-
.map(f -> new File(f.getName())).findFirst().get();
306+
.map(f -> new File(f.getName()))
307+
.findFirst()
308+
.orElse(null);
307309
}
308310

309311
/**

0 commit comments

Comments
 (0)