summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteve Howard <showard@google.com>2010-09-30 16:23:10 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2010-09-30 16:23:10 -0700
commit8df47822435f7f66dd34f87dcaa73bbbcd808483 (patch)
tree32b525551d3e3c7ce45132d262560dadbd9f3b01
parent6fbdadce019f91770c81f4db6421c2828e62a15f (diff)
parent4c1c7cba491e1ace6cec44bed04c4debe3a4f8f1 (diff)
downloadandroid_packages_providers_DownloadProvider-8df47822435f7f66dd34f87dcaa73bbbcd808483.zip
android_packages_providers_DownloadProvider-8df47822435f7f66dd34f87dcaa73bbbcd808483.tar.gz
android_packages_providers_DownloadProvider-8df47822435f7f66dd34f87dcaa73bbbcd808483.tar.bz2
Merge "Handle null local URI when deleting a download." into gingerbread
-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);