mirror of
https://github.com/2009scape/2009Scape-mobile.git
synced 2026-08-28 05:45:03 -06:00
Crash log: The NPE was able to escape, so catch it!
This commit is contained in:
parent
252b5e0471
commit
0338bdcb36
1 changed files with 10 additions and 8 deletions
|
|
@ -663,19 +663,21 @@ public final class Tools {
|
|||
File fl = new File(dir);
|
||||
|
||||
File[] files = fl.listFiles(File::isFile);
|
||||
if (files == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
long lastMod = Long.MIN_VALUE;
|
||||
File choice = null;
|
||||
for (File file : files) {
|
||||
if (file.lastModified() > lastMod) {
|
||||
choice = file;
|
||||
lastMod = file.lastModified();
|
||||
try {
|
||||
for (File file : files) {
|
||||
if (file.lastModified() > lastMod) {
|
||||
choice = file;
|
||||
lastMod = file.lastModified();
|
||||
}
|
||||
}
|
||||
} catch (NullPointerException e) {
|
||||
// fine, let's just return null
|
||||
// if (files == null) didn't work for some reasons
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return choice;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue