Fix issue #17175312: Calendar crashed when tapping on the event notification
mActivities can be null.
Change-Id: I9cc1a08d19d2c38a4ebaaf0ed2168cfbeeaf3b51
diff --git a/services/core/java/com/android/server/am/ActivityStack.java b/services/core/java/com/android/server/am/ActivityStack.java
index 3efd049..e83963d 100755
--- a/services/core/java/com/android/server/am/ActivityStack.java
+++ b/services/core/java/com/android/server/am/ActivityStack.java
@@ -456,7 +456,7 @@
final ActivityRecord r = ActivityRecord.forToken(token);
if (r != null) {
final TaskRecord task = r.task;
- if (task.mActivities.contains(r) && mTaskHistory.contains(task)) {
+ if (task != null && task.mActivities.contains(r) && mTaskHistory.contains(task)) {
if (task.stack != this) Slog.w(TAG,
"Illegal state! task does not point to stack it is in.");
return r;