summaryrefslogtreecommitdiffstats
path: root/src/com/android/providers/downloads
diff options
context:
space:
mode:
authorChristopher Tate <ctate@google.com>2015-06-08 18:17:21 -0700
committerChristopher Tate <ctate@google.com>2015-06-08 18:17:21 -0700
commit810d83eac854f2da48f4ba7e7e6f68c39ce8f292 (patch)
tree976847868e2db5c7e72b95ccafd7c2f5782f86a7 /src/com/android/providers/downloads
parent06e3ea49e8f9b2b60981e499a64ed6b150106173 (diff)
downloadandroid_packages_providers_DownloadProvider-810d83eac854f2da48f4ba7e7e6f68c39ce8f292.tar.gz
android_packages_providers_DownloadProvider-810d83eac854f2da48f4ba7e7e6f68c39ce8f292.tar.bz2
android_packages_providers_DownloadProvider-810d83eac854f2da48f4ba7e7e6f68c39ce8f292.zip
Don't call size() on a null List
JobScheduler.getAllPendingJobs() can return null when there are none. Deal with it. Bug 21642868 Change-Id: I11fcc6e146f9db51e03dcf57f7518bb7878fbd28
Diffstat (limited to 'src/com/android/providers/downloads')
-rw-r--r--src/com/android/providers/downloads/DownloadService.java12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/com/android/providers/downloads/DownloadService.java b/src/com/android/providers/downloads/DownloadService.java
index 58cf380c..b0b73297 100644
--- a/src/com/android/providers/downloads/DownloadService.java
+++ b/src/com/android/providers/downloads/DownloadService.java
@@ -219,11 +219,13 @@ public class DownloadService extends Service {
private boolean needToScheduleCleanup(JobScheduler js) {
List<JobInfo> myJobs = js.getAllPendingJobs();
- final int N = myJobs.size();
- for (int i = 0; i < N; i++) {
- if (myJobs.get(i).getId() == CLEANUP_JOB_ID) {
- // It's already been (persistently) scheduled; no need to do it again
- return false;
+ if (myJobs != null) {
+ final int N = myJobs.size();
+ for (int i = 0; i < N; i++) {
+ if (myJobs.get(i).getId() == CLEANUP_JOB_ID) {
+ // It's already been (persistently) scheduled; no need to do it again
+ return false;
+ }
}
}
return true;