From 4c1c7cba491e1ace6cec44bed04c4debe3a4f8f1 Mon Sep 17 00:00:00 2001 From: Steve Howard Date: Thu, 30 Sep 2010 11:39:40 -0700 Subject: Handle null local URI when deleting a download. I'd written this to assume a non-null local URI, but I forgot the legacy downloads can still have null local URI, so this handling needs to remain until the legacy API is dead and gone. Change-Id: Icfe8dc2a6fead03b09cabe684c713fb6f0e6c1ab --- ui/src/com/android/providers/downloads/ui/DownloadList.java | 8 +++++--- 1 file 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); -- cgit v1.2.3