BuckPrologCompiler: Fix potential NPE
File.list() can return null, so it's unsafe to use it as an iterator in a for-loop. Store the result of File.list() first and only iterate it when it's not null. Change-Id: I0ced67e5bb5bc588433cb6a03a6283f9b31cb649
This commit is contained in:
parent
a57ae4a249
commit
1e2458a0ef
@ -63,7 +63,11 @@ public class BuckPrologCompiler {
|
||||
|
||||
private static void add(JarOutputStream out, File classes, String prefix)
|
||||
throws IOException {
|
||||
for (String name : classes.list()) {
|
||||
String[] list = classes.list();
|
||||
if (list == null) {
|
||||
return;
|
||||
}
|
||||
for (String name : list) {
|
||||
File f = new File(classes, name);
|
||||
if (f.isDirectory()) {
|
||||
add(out, f, prefix + name + "/");
|
||||
|
Loading…
Reference in New Issue
Block a user