Skip to content

Commit

Permalink
Cleanup PR MobileChromeApps#14: Handle null returns from mapUriToFile.
Browse files Browse the repository at this point in the history
  • Loading branch information
bshepherdson committed Feb 19, 2014
1 parent a1de053 commit 36ba589
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/android/Zip.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,14 @@ private void unzipSync(CordovaArgs args, CallbackContext callbackContext) {
CordovaResourceApi resourceApi = webView.getResourceApi();

File tempFile = resourceApi.mapUriToFile(zipUri);
boolean ex = tempFile.exists();
if(!ex) {
Log.e(LOG_TAG, "Doesn't exist");
if(tempFile == null || !tempFile.exists()) {
Log.e(LOG_TAG, "Zip file does not exist");
}

File outputDir = resourceApi.mapUriToFile(outputUri);
outputDirectory = outputDir.getAbsolutePath();
outputDirectory += outputDirectory.endsWith(File.separator) ? "" : File.separator;
if(!outputDir.exists() && !outputDir.mkdirs()){
if(outputDir == null || (!outputDir.exists() && !outputDir.mkdirs())){
throw new FileNotFoundException("File: \"" + outputDirectory + "\" not found");
}

Expand Down

0 comments on commit 36ba589

Please sign in to comment.