summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteve Howard <showard@google.com>2010-09-30 11:39:40 -0700
committerSteve Howard <showard@google.com>2010-09-30 15:02:25 -0700
commit4c1c7cba491e1ace6cec44bed04c4debe3a4f8f1 (patch)
tree17637437676a93e2aea7df7cd2a6406bf3250457
parentb108a273b150e81bf26553b8851d6241bc711f98 (diff)
downloadandroid_packages_providers_DownloadProvider-4c1c7cba491e1ace6cec44bed04c4debe3a4f8f1.zip
android_packages_providers_DownloadProvider-4c1c7cba491e1ace6cec44bed04c4debe3a4f8f1.tar.gz
android_packages_providers_DownloadProvider-4c1c7cba491e1ace6cec44bed04c4debe3a4f8f1.tar.bz2
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
-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 bb33153..f1cb91f 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);