Adding NPE check when the system has no tasks.

Bug: 20640135
Change-Id: Ifb62d18dbf2125bc33325b7c2f2a44da51309325
This commit is contained in:
Winson Chung
2015-05-27 12:45:20 -07:00
parent 8141d6e150
commit 65c294036b

View File

@@ -227,7 +227,7 @@ public class SystemServicesProxy {
/** Returns the top task. */
public ActivityManager.RunningTaskInfo getTopMostTask() {
List<ActivityManager.RunningTaskInfo> tasks = getRunningTasks(1);
if (!tasks.isEmpty()) {
if (tasks != null && !tasks.isEmpty()) {
return tasks.get(0);
}
return null;