Fixed NPE when trying to open a downloaded file with an empty replay_recordings folder

This commit is contained in:
CrushedPixel
2015-08-31 17:30:39 +02:00
parent e0259d0c5a
commit 5eed7a8246

View File

@@ -50,7 +50,9 @@ public class GuiReplayInstanceChooser extends GuiScreen {
List<File> chooseableFiles = new ArrayList<File>(); List<File> chooseableFiles = new ArrayList<File>();
for(File file : replayFolder.listFiles()) { File[] files = replayFolder.listFiles();
if(files != null) {
for(File file : files) {
try { try {
String extension = FilenameUtils.getExtension(file.getAbsolutePath()); String extension = FilenameUtils.getExtension(file.getAbsolutePath());
if(!("." + extension).equals(ReplayFile.ZIP_FILE_EXTENSION)) continue; if(!("." + extension).equals(ReplayFile.ZIP_FILE_EXTENSION)) continue;
@@ -66,6 +68,7 @@ public class GuiReplayInstanceChooser extends GuiScreen {
e.printStackTrace(); e.printStackTrace();
} }
} }
}
//if no modified versions of the replay were found, start the downloaded one //if no modified versions of the replay were found, start the downloaded one
if(chooseableFiles.isEmpty()) { if(chooseableFiles.isEmpty()) {