Fixed NPE when trying to open a downloaded file with an empty replay_recordings folder
This commit is contained in:
@@ -50,20 +50,23 @@ 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();
|
||||||
try {
|
if(files != null) {
|
||||||
String extension = FilenameUtils.getExtension(file.getAbsolutePath());
|
for(File file : files) {
|
||||||
if(!("." + extension).equals(ReplayFile.ZIP_FILE_EXTENSION)) continue;
|
try {
|
||||||
|
String extension = FilenameUtils.getExtension(file.getAbsolutePath());
|
||||||
|
if(!("." + extension).equals(ReplayFile.ZIP_FILE_EXTENSION)) continue;
|
||||||
|
|
||||||
String filename = FilenameUtils.getBaseName(file.getAbsolutePath());
|
String filename = FilenameUtils.getBaseName(file.getAbsolutePath());
|
||||||
String[] split = filename.split("_");
|
String[] split = filename.split("_");
|
||||||
String first = split[0];
|
String first = split[0];
|
||||||
|
|
||||||
if(StringUtils.isNumeric(first) && Integer.valueOf(first) == id) {
|
if(StringUtils.isNumeric(first) && Integer.valueOf(first) == id) {
|
||||||
chooseableFiles.add(file);
|
chooseableFiles.add(file);
|
||||||
|
}
|
||||||
|
} catch(Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
} catch(Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user