NPE check before finalizeDestinationFile().
Jeff Sharkey [Fri, 14 Oct 2011 20:39:55 +0000 (13:39 -0700)]
Bug: 5461417
Change-Id: I16f1e8594162b006b80bf7f2cdc6630d0dedfa38

src/com/android/providers/downloads/DownloadThread.java

index c4b6353..63a51a8 100644 (file)
@@ -315,9 +315,11 @@ public class DownloadThread extends Thread {
      * Called after a successful completion to take any necessary action on the downloaded file.
      */
     private void finalizeDestinationFile(State state) throws StopRequestException {
-        // make sure the file is readable
-        FileUtils.setPermissions(state.mFilename, 0644, -1, -1);
-        syncDestination(state);
+        if (state.mFilename != null) {
+            // make sure the file is readable
+            FileUtils.setPermissions(state.mFilename, 0644, -1, -1);
+            syncDestination(state);
+        }
     }
 
     /**