Add the null ptr check that's not merged in master

ag/1379112 merged to DR branch had an extra null ptr check,
this shouldn't really happen but merge it to master to keep
the branch consistent.

Change-Id: I5047188729be26a7b7190b2ab3f5d8274bca32d5
diff --git a/services/core/java/com/android/server/am/ActivityStack.java b/services/core/java/com/android/server/am/ActivityStack.java
index dacbcc6..20bc779 100644
--- a/services/core/java/com/android/server/am/ActivityStack.java
+++ b/services/core/java/com/android/server/am/ActivityStack.java
@@ -2561,7 +2561,7 @@
                     // what's left last time.
                     for (int i = next.newIntents.size() - 1; i >= 0; i--) {
                         final Intent intent = next.newIntents.get(i);
-                        if (!ActivityRecord.isMainIntent(intent)) {
+                        if (intent != null && !ActivityRecord.isMainIntent(intent)) {
                             allowSavedSurface = false;
                             break;
                         }