summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ui/src/com/android/providers/downloads/ui/DownloadList.java8
1 files changed, 5 insertions, 3 deletions
diff --git a/ui/src/com/android/providers/downloads/ui/DownloadList.java b/ui/src/com/android/providers/downloads/ui/DownloadList.java
index bb331534..f1cb91fe 100644
--- a/ui/src/com/android/providers/downloads/ui/DownloadList.java
+++ b/ui/src/com/android/providers/downloads/ui/DownloadList.java
@@ -582,9 +582,11 @@ public class DownloadList extends Activity
private void deleteDownload(long downloadId) {
if (moveToDownload(downloadId)) {
int status = mDateSortedCursor.getInt(mStatusColumnId);
- if (status == DownloadManager.STATUS_SUCCESSFUL
- || status == DownloadManager.STATUS_FAILED) {
- String path = Uri.parse(mDateSortedCursor.getString(mLocalUriColumnId)).getPath();
+ boolean isComplete = status == DownloadManager.STATUS_SUCCESSFUL
+ || status == DownloadManager.STATUS_FAILED;
+ String localUri = mDateSortedCursor.getString(mLocalUriColumnId);
+ if (isComplete && localUri != null) {
+ String path = Uri.parse(localUri).getPath();
if (path.startsWith(Environment.getExternalStorageDirectory().getPath())) {
String mediaType = mDateSortedCursor.getString(mMediaTypeColumnId);
deleteDownloadedFile(path, mediaType);