From 6d98a8b92cec56b9f7cfdb080505c6c9c4c9136a Mon Sep 17 00:00:00 2001 From: Maschell Date: Thu, 28 Feb 2019 10:03:11 +0100 Subject: [PATCH] File::listFiles may return null, let's catch that potentional null pointer. --- src/de/mas/wiiu/jnus/utils/FileUtils.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/de/mas/wiiu/jnus/utils/FileUtils.java b/src/de/mas/wiiu/jnus/utils/FileUtils.java index d9f9249..ef020f7 100644 --- a/src/de/mas/wiiu/jnus/utils/FileUtils.java +++ b/src/de/mas/wiiu/jnus/utils/FileUtils.java @@ -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;