Skip to content
Permalink
Browse files
- Changed code to be safe against NullPointerExceptions
  • Loading branch information
chrisdutz committed Jul 23, 2016
1 parent 80051f0 commit 3a8686ff175e3269f6a30c73d3dcfdc7b1b172a4
Showing 1 changed file with 12 additions and 3 deletions.
@@ -83,15 +83,21 @@ protected void generateCompilerArtifacts() throws ConverterException {
throw new ConverterException("Compiler directory does not exist.");
}
final List<File> files = new ArrayList<File>();
files.addAll(Arrays.asList(directory.listFiles(new AirCompilerFilter())));
File[] compilerFiles = directory.listFiles(new AirCompilerFilter());
if(compilerFiles != null) {
files.addAll(Arrays.asList(compilerFiles));
}

// Add the smali.jar and baksmali.jar from the android/lib directory
// as this is needed for Android packaging.
File androidDir = new File(directory, "android");
if (androidDir.exists() && androidDir.isDirectory()) {
File androidLibDir = new File(androidDir, "lib");
if (androidLibDir.exists() && androidLibDir.isDirectory()) {
files.addAll(Arrays.asList(androidLibDir.listFiles(new AirCompilerFilter())));
File[] compilerLibs = androidLibDir.listFiles(new AirCompilerFilter());
if(compilerLibs != null) {
files.addAll(Arrays.asList(compilerLibs));
}
}
}

@@ -328,7 +334,10 @@ protected void generateFrameworkArtifacts() throws ConverterException {
throw new ConverterException("Framework directory does not exist.");
}
final List<File> files = new ArrayList<File>();
files.addAll(Arrays.asList(directory.listFiles(new AirFrameworkFilter())));
File[] frameworkFiles = directory.listFiles(new AirFrameworkFilter());
if(frameworkFiles != null) {
files.addAll(Arrays.asList(frameworkFiles));
}

// Generate artifacts for every jar in the input directories.
for (final File sourceFile : files) {

0 comments on commit 3a8686f

Please sign in to comment.