mirror of
https://github.com/AngelAuraMC/Amethyst-Android.git
synced 2025-09-15 07:39:00 -04:00
Crash log: The NPE was able to escape, so catch it!
This commit is contained in:
parent
252b5e0471
commit
0338bdcb36
@ -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…
x
Reference in New Issue
Block a user