mirror of
https://github.com/esp8266/Arduino.git
synced 2025-07-30 16:24:09 +03:00
Several File.list() calls missed check for null return value. Fixed
This commit is contained in:
@ -2604,12 +2604,15 @@ public class Base {
|
||||
File targetDir) throws IOException {
|
||||
targetDir.mkdirs();
|
||||
String files[] = sourceDir.list();
|
||||
for (int i = 0; i < files.length; i++) {
|
||||
if (files == null) {
|
||||
throw new IOException("Unable to list files from " + sourceDir);
|
||||
}
|
||||
for (String file : files) {
|
||||
// Ignore dot files (.DS_Store), dot folders (.svn) while copying
|
||||
if (files[i].charAt(0) == '.') continue;
|
||||
if (file.charAt(0) == '.') continue;
|
||||
//if (files[i].equals(".") || files[i].equals("..")) continue;
|
||||
File source = new File(sourceDir, files[i]);
|
||||
File target = new File(targetDir, files[i]);
|
||||
File source = new File(sourceDir, file);
|
||||
File target = new File(targetDir, file);
|
||||
if (source.isDirectory()) {
|
||||
//target.mkdirs();
|
||||
copyDir(source, target);
|
||||
|
@ -150,6 +150,9 @@ public class Archiver implements Tool {
|
||||
public void buildZip(File dir, String sofar,
|
||||
ZipOutputStream zos) throws IOException {
|
||||
String files[] = dir.list();
|
||||
if (files == null) {
|
||||
throw new IOException("Unable to list files from " + dir);
|
||||
}
|
||||
for (int i = 0; i < files.length; i++) {
|
||||
if (files[i].equals(".") ||
|
||||
files[i].equals("..")) continue;
|
||||
|
Reference in New Issue
Block a user