Skip to content

Commit b71a5bc

Browse files
committed
Check for valid records associated with activity tokens in
ActivityManagerService up-navigation methods. Silly monkeys. Fixes bug 6328725 Change-Id: Ifec3f162bdfc2e7e872a689210752c0f6b9b0ab7
1 parent 69c1a57 commit b71a5bc

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

services/java/com/android/server/am/ActivityManagerService.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13398,7 +13398,8 @@ private void saveLocaleLocked(Locale l, boolean isDiff, boolean isPersist) {
1339813398
@Override
1339913399
public boolean targetTaskAffinityMatchesActivity(IBinder token, String destAffinity) {
1340013400
ActivityRecord srec = ActivityRecord.forToken(token);
13401-
return srec.task.affinity != null && srec.task.affinity.equals(destAffinity);
13401+
return srec != null && srec.task.affinity != null &&
13402+
srec.task.affinity.equals(destAffinity);
1340213403
}
1340313404

1340413405
public boolean navigateUpTo(IBinder token, Intent destIntent, int resultCode,
@@ -13407,6 +13408,9 @@ public boolean navigateUpTo(IBinder token, Intent destIntent, int resultCode,
1340713408

1340813409
synchronized (this) {
1340913410
ActivityRecord srec = ActivityRecord.forToken(token);
13411+
if (srec == null) {
13412+
return false;
13413+
}
1341013414
ArrayList<ActivityRecord> history = srec.stack.mHistory;
1341113415
final int start = history.indexOf(srec);
1341213416
if (start < 0) {

0 commit comments

Comments
 (0)