OSDN Git Service

Fix for possible NPE in JobScheduler
authorShreyas Basarge <snb@google.com>
Fri, 15 Jan 2016 18:24:36 +0000 (18:24 +0000)
committerShreyas Basarge <snb@google.com>
Fri, 15 Jan 2016 18:24:36 +0000 (18:24 +0000)
Fixes a possible NPE in JobScheduler

Change-Id: I4faa414ea92ab65326001f83de4624834b5ed955

services/core/java/com/android/server/job/JobSchedulerService.java

index a6db613..e5a3264 100644 (file)
@@ -905,6 +905,11 @@ public class JobSchedulerService extends com.android.server.SystemService
                     minPriorityContextId = i;
                     break;
                 }
+                if (job == null) {
+                    // No job on this context, but nextPending can't run here because
+                    // the context has a preferred Uid.
+                    continue;
+                }
                 if (job.getUid() != nextPending.getUid()) {
                     continue;
                 }