mirror of
https://github.com/Maschell/JNUSLib.git
synced 2024-11-22 07:59:19 +01:00
File::listFiles may return null, let's catch that potentional null pointer.
This commit is contained in:
parent
73b6787c42
commit
6d98a8b92c
@ -17,7 +17,6 @@
|
||||
package de.mas.wiiu.jnus.utils;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
@ -100,7 +99,7 @@ public final class FileUtils {
|
||||
if (!filepath.exists()) {
|
||||
// Try to find it ignoring cases.
|
||||
File[] filesIngoringCases = new File(folder).listFiles(f -> f.getName().equalsIgnoreCase(filename));
|
||||
if (filesIngoringCases.length == 1 && !filesIngoringCases[0].isDirectory()) {
|
||||
if (filesIngoringCases != null && filesIngoringCases.length == 1 && !filesIngoringCases[0].isDirectory()) {
|
||||
return filesIngoringCases[0].getAbsoluteFile();
|
||||
} else {
|
||||
return null;
|
||||
|
Loading…
Reference in New Issue
Block a user