Fix NPE when checking if recents should be launched in docked mode.

In some cases the activity starting method might return early with
positive return code, even though it skipped doing most of the work
and the target stack is not set. We need to protect ourselves from
an NPE in that case.

Bug: 26541093

Change-Id: I7227ad8efa30c52dd8178ad3c9d8b2263c89a74f
This commit is contained in:
Filip Gruszczynski
2016-01-17 09:12:31 -08:00
parent e5480cc52a
commit ddb96df921

View File

@@ -1034,7 +1034,8 @@ class ActivityStarter {
}
private void launchRecentsAppIfNeeded(ActivityStack topStack) {
if (topStack.mStackId == HOME_STACK_ID && mTargetStack.mStackId == DOCKED_STACK_ID) {
if (topStack.mStackId == HOME_STACK_ID && mTargetStack != null
&& mTargetStack.mStackId == DOCKED_STACK_ID) {
// We launch an activity while being in home stack, which means either launcher or
// recents into docked stack. We don't want the launched activity to be alone in a
// docked stack, so we want to immediately launch recents too.